Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import gradio as gr
|
|
4 |
model_1 = gr.load("models/pimpilikipilapi1/NSFW_master")
|
5 |
model_2 = gr.load("models/DiegoJR1973/NSFW-TrioHMH-Flux")
|
6 |
model_3 = gr.load("models/prashanth970/flux-lora-uncensored")
|
|
|
|
|
7 |
|
8 |
default_negative_prompt = (
|
9 |
"Extra limbs, Extra fingers or toes, Disfigured face, Distorted hands, Mutated body parts, "
|
@@ -18,24 +20,40 @@ default_negative_prompt = (
|
|
18 |
)
|
19 |
|
20 |
|
21 |
-
def
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
try:
|
25 |
-
|
26 |
except TypeError:
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
|
|
|
34 |
interface = gr.Interface(
|
35 |
fn=lambda prompt, negative_prompt: (
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
),
|
40 |
inputs=[
|
41 |
gr.Textbox(label="Type your prompt here: ✍️", placeholder="Describe what you want..."),
|
@@ -45,9 +63,10 @@ interface = gr.Interface(
|
|
45 |
gr.Image(label="Generated Image - Model 1"),
|
46 |
gr.Image(label="Generated Image - Model 2"),
|
47 |
gr.Image(label="Generated Image - Model 3"),
|
|
|
48 |
],
|
49 |
-
title="Text to Image
|
50 |
-
description="⚠️ Sorry for the inconvenience. The
|
51 |
)
|
52 |
|
53 |
-
interface.launch()
|
|
|
4 |
model_1 = gr.load("models/pimpilikipilapi1/NSFW_master")
|
5 |
model_2 = gr.load("models/DiegoJR1973/NSFW-TrioHMH-Flux")
|
6 |
model_3 = gr.load("models/prashanth970/flux-lora-uncensored")
|
7 |
+
model_4 = gr.load("models/Purz/face-projection")
|
8 |
+
|
9 |
|
10 |
default_negative_prompt = (
|
11 |
"Extra limbs, Extra fingers or toes, Disfigured face, Distorted hands, Mutated body parts, "
|
|
|
20 |
)
|
21 |
|
22 |
|
23 |
+
def generate_image_model_1(prompt, negative_prompt):
|
24 |
+
prompt += " 2k"
|
25 |
+
try:
|
26 |
+
return model_1(prompt, negative_prompt=negative_prompt)
|
27 |
+
except TypeError:
|
28 |
+
return model_1(prompt)
|
29 |
+
|
30 |
+
def generate_image_model_2(prompt, negative_prompt):
|
31 |
+
prompt += " 8k"
|
32 |
try:
|
33 |
+
return model_2(prompt, negative_prompt=negative_prompt)
|
34 |
except TypeError:
|
35 |
+
return model_2(prompt)
|
36 |
|
37 |
+
def generate_image_model_3(prompt, negative_prompt):
|
38 |
+
prompt += " 10k"
|
39 |
+
try:
|
40 |
+
return model_3(prompt, negative_prompt=negative_prompt)
|
41 |
+
except TypeError:
|
42 |
+
return model_3(prompt)
|
43 |
|
44 |
+
def generate_image_model_4(prompt, negative_prompt):
|
45 |
+
try:
|
46 |
+
return model_4(prompt)
|
47 |
+
except TypeError:
|
48 |
+
return model_4(prompt)
|
49 |
|
50 |
+
# Gradio interface
|
51 |
interface = gr.Interface(
|
52 |
fn=lambda prompt, negative_prompt: (
|
53 |
+
generate_image_model_1(prompt, negative_prompt),
|
54 |
+
generate_image_model_2(prompt, negative_prompt),
|
55 |
+
generate_image_model_3(prompt, negative_prompt),
|
56 |
+
generate_image_model_4(prompt, negative_prompt),
|
57 |
),
|
58 |
inputs=[
|
59 |
gr.Textbox(label="Type your prompt here: ✍️", placeholder="Describe what you want..."),
|
|
|
63 |
gr.Image(label="Generated Image - Model 1"),
|
64 |
gr.Image(label="Generated Image - Model 2"),
|
65 |
gr.Image(label="Generated Image - Model 3"),
|
66 |
+
gr.Image(label="Generated Image - Model 4"),
|
67 |
],
|
68 |
+
title="Text to Image Generator",
|
69 |
+
description="⚠️ Sorry for the inconvenience. The models are currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
70 |
)
|
71 |
|
72 |
+
interface.launch()
|