File size: 1,382 Bytes
fcad6de
fb624fd
 
 
 
 
2d6dde4
 
fcad6de
fb624fd
fcad6de
2d6dde4
 
 
 
 
 
 
fb624fd
f13d354
7ad81df
fb624fd
 
2d6dde4
 
fb624fd
 
2d6dde4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
import torch
import numpy as np
import modin.pandas as pd
from PIL import Image
from diffusers import DiffusionPipeline
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel


device = "cuda" if torch.cuda.is_available() else "cpu"

controlnet = ControlNetModel.from_pretrained("CrucibleAI/ControlNetMediaPipeFace", torch_dtype=torch.float16)
pipe = StableDiffusionControlNetPipeline.from_pretrained(
    "krnl/venereital-IA-23",  controlnet=controlnet, torch_dtype=torch.float16
).to("cuda")
ì



def genie (prompt, negative_prompt):
     generator = torch.Generator(device=device).manual_seed(-1)
     prompt = "photo of sks person, " + prompt
     negative_prompt = "nude, naked, tits, nsfw, " + negative_prompt
     centered = Image.open("centered.png").convert("RGB")
     images = pipe(prompt, image=centered, negative_prompt=negative_prompt, width=512, height=512, num_inference_steps=25, guidance_scale=7, num_images_per_prompt=1, generator=generator).images[0]
     return images
    
gr.Interface(fn=genie, inputs=[gr.Textbox(label='Descrivi la tua venere ideale (IN ENGLISH) ex: wearing sunglasses'), gr.Textbox(label='Descrivi cosa non vorresti vedere, (IN ENGLISH) ex: wearing hat')], outputs='image', title="Generatore di Venere", description="Genera la tua Venere! Scatena la tua fantsIA!").launch(debug=True, max_threads=True)