Spaces:
Runtime error
Runtime error
controlnet
Browse files- app.py +12 -4
- centered.png +0 -0
app.py
CHANGED
@@ -4,17 +4,25 @@ import numpy as np
|
|
4 |
import modin.pandas as pd
|
5 |
from PIL import Image
|
6 |
from diffusers import DiffusionPipeline
|
|
|
|
|
7 |
|
8 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
9 |
|
10 |
-
|
11 |
-
pipe =
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def genie (prompt, negative_prompt):
|
14 |
generator = torch.Generator(device=device).manual_seed(-1)
|
15 |
prompt = "photo of sks person, " + prompt
|
16 |
negative_prompt = "nude, naked, tits, nsfw, " + negative_prompt
|
17 |
-
|
|
|
18 |
return images
|
19 |
|
20 |
-
gr.Interface(fn=genie, inputs=[gr.Textbox(label='Descrivi la tua venere ideale
|
|
|
4 |
import modin.pandas as pd
|
5 |
from PIL import Image
|
6 |
from diffusers import DiffusionPipeline
|
7 |
+
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel
|
8 |
+
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
|
12 |
+
controlnet = ControlNetModel.from_pretrained("CrucibleAI/ControlNetMediaPipeFace", torch_dtype=torch.float16)
|
13 |
+
pipe = StableDiffusionControlNetPipeline.from_pretrained(
|
14 |
+
"krnl/venereital-IA-23", controlnet=controlnet, torch_dtype=torch.float16
|
15 |
+
).to("cuda")
|
16 |
+
ì
|
17 |
+
|
18 |
+
|
19 |
|
20 |
def genie (prompt, negative_prompt):
|
21 |
generator = torch.Generator(device=device).manual_seed(-1)
|
22 |
prompt = "photo of sks person, " + prompt
|
23 |
negative_prompt = "nude, naked, tits, nsfw, " + negative_prompt
|
24 |
+
centered = Image.open("centered.png").convert("RGB")
|
25 |
+
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]
|
26 |
return images
|
27 |
|
28 |
+
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)
|
centered.png
ADDED