Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -3,44 +3,34 @@
|
|
3 |
#model3 = gr.load("models/prashanth970/flux-lora-uncensored")
|
4 |
|
5 |
import gradio as gr
|
6 |
-
import random
|
7 |
-
import os
|
8 |
|
|
|
|
|
9 |
|
10 |
-
model = gr.load("models/pimpilikipilapi1/NSFW_master")
|
11 |
|
12 |
-
def generate_image(text,
|
13 |
-
if
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
return result_image
|
21 |
|
22 |
-
def randomize_parameters():
|
23 |
-
seed = random.randint(0, 999999)
|
24 |
-
width = random.randint(512, 2048)
|
25 |
-
height = random.randint(512, 2048)
|
26 |
-
guidance_scale = round(random.uniform(0.1, 20.0), 1)
|
27 |
-
num_inference_steps = random.randint(1, 40)
|
28 |
-
|
29 |
-
return seed, width, height, guidance_scale, num_inference_steps
|
30 |
|
31 |
interface = gr.Interface(
|
32 |
fn=generate_image,
|
33 |
inputs=[
|
34 |
gr.Textbox(label="Type here your imagination:", placeholder="Type your prompt..."),
|
35 |
-
gr.
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
],
|
41 |
outputs=gr.Image(label="Generated Image"),
|
42 |
-
theme="
|
43 |
-
description="Sorry for the inconvenience. The
|
44 |
)
|
45 |
|
46 |
-
interface.launch()
|
|
|
3 |
#model3 = gr.load("models/prashanth970/flux-lora-uncensored")
|
4 |
|
5 |
import gradio as gr
|
|
|
|
|
6 |
|
7 |
+
model1 = gr.load("models/pimpilikipilapi1/NSFW_master")
|
8 |
+
model2 = gr.load("models/prashanth970/flux-lora-uncensored")
|
9 |
|
|
|
10 |
|
11 |
+
def generate_image(text, selected_model):
|
12 |
+
if selected_model == "Model 1 (NSFW Master)":
|
13 |
+
result_image = model1(text)
|
14 |
+
elif selected_model == "Model 2 (Flux Lora Uncensored)":
|
15 |
+
result_image = model2(text)
|
16 |
+
else:
|
17 |
+
return "Invalid model selection."
|
|
|
18 |
return result_image
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
interface = gr.Interface(
|
22 |
fn=generate_image,
|
23 |
inputs=[
|
24 |
gr.Textbox(label="Type here your imagination:", placeholder="Type your prompt..."),
|
25 |
+
gr.Radio(
|
26 |
+
["Model 1 (NSFW Master)", "Model 2 (Flux Lora Uncensored)"],
|
27 |
+
label="Select Model",
|
28 |
+
value="Model 1 (NSFW Master)",
|
29 |
+
),
|
30 |
],
|
31 |
outputs=gr.Image(label="Generated Image"),
|
32 |
+
theme="Yntec/HaleyCH_Theme_Orange",
|
33 |
+
description="Sorry for the inconvenience. The models are currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
34 |
)
|
35 |
|
36 |
+
interface.launch()
|