Spaces:
Runtime error
Runtime error
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) | |
prompt = "photo of sks person, " + prompt | |
centered = Image.open("centered.png").convert("RGB") | |
images = pipe(prompt, controlnet_conditioning_scale=0.99, image=centered, negative_prompt=negative_prompt, width=512, height=512, num_inference_steps=20, guidance_scale=3.5, num_images_per_prompt=1).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) |