Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import time
|
| 3 |
|
| 4 |
-
|
| 5 |
-
models =[
|
| 6 |
"pimpilikipilapi1/NSFW_master",
|
| 7 |
"DiegoJR1973/NSFW-TrioHMH-Flux",
|
| 8 |
"prashanth970/flux-lora-uncensored",
|
|
@@ -17,7 +16,7 @@ for model_path in models:
|
|
| 17 |
def the_fn(txt):
|
| 18 |
return None
|
| 19 |
model_functions[model_idx] = gr.Interface(fn=the_fn, inputs=["text"], outputs=["image"])
|
| 20 |
-
model_idx+=1
|
| 21 |
|
| 22 |
|
| 23 |
def send_it_idx(idx):
|
|
@@ -62,18 +61,16 @@ def all_task_start():
|
|
| 62 |
def clear_fn():
|
| 63 |
nn = len(models)
|
| 64 |
return tuple([None, *[None for _ in range(nn)]])
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
with gr.Blocks(title="SD Models") as my_interface:
|
| 69 |
-
with gr.Column(
|
| 70 |
with gr.Row():
|
| 71 |
-
with gr.
|
| 72 |
-
primary_prompt=gr.Textbox(label="Prompt", value="")
|
| 73 |
-
with gr.
|
| 74 |
with gr.Row():
|
| 75 |
-
run=gr.Button("Run",variant="primary")
|
| 76 |
-
clear_btn=gr.Button("Clear")
|
| 77 |
with gr.Row():
|
| 78 |
sd_outputs = {}
|
| 79 |
model_idx = 1
|
|
@@ -84,12 +81,11 @@ with gr.Blocks(title="SD Models") as my_interface:
|
|
| 84 |
pass
|
| 85 |
model_idx += 1
|
| 86 |
pass
|
| 87 |
-
pass
|
| 88 |
|
| 89 |
with gr.Row(visible=False):
|
| 90 |
-
start_box=gr.Number(interactive=False)
|
| 91 |
-
end_box=gr.Number(interactive=False)
|
| 92 |
-
tog_box=gr.Textbox(value=0,interactive=False)
|
| 93 |
|
| 94 |
start_box.change(
|
| 95 |
all_task_end,
|
|
@@ -105,8 +101,6 @@ with gr.Blocks(title="SD Models") as my_interface:
|
|
| 105 |
for model_path in models:
|
| 106 |
runs_dict[model_idx] = run.click(model_functions[model_idx], inputs=[primary_prompt], outputs=[sd_outputs[model_idx]])
|
| 107 |
model_idx += 1
|
| 108 |
-
pass
|
| 109 |
-
pass
|
| 110 |
|
| 111 |
clear_btn.click(
|
| 112 |
clear_fn,
|
|
@@ -120,4 +114,4 @@ with gr.Blocks(title="SD Models") as my_interface:
|
|
| 120 |
cancels=[*list(runs_dict.values())])
|
| 121 |
|
| 122 |
my_interface.queue(concurrency_count=100, status_update_rate=1)
|
| 123 |
-
my_interface.launch(inline=True, show_api=False)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import time
|
| 3 |
|
| 4 |
+
models = [
|
|
|
|
| 5 |
"pimpilikipilapi1/NSFW_master",
|
| 6 |
"DiegoJR1973/NSFW-TrioHMH-Flux",
|
| 7 |
"prashanth970/flux-lora-uncensored",
|
|
|
|
| 16 |
def the_fn(txt):
|
| 17 |
return None
|
| 18 |
model_functions[model_idx] = gr.Interface(fn=the_fn, inputs=["text"], outputs=["image"])
|
| 19 |
+
model_idx += 1
|
| 20 |
|
| 21 |
|
| 22 |
def send_it_idx(idx):
|
|
|
|
| 61 |
def clear_fn():
|
| 62 |
nn = len(models)
|
| 63 |
return tuple([None, *[None for _ in range(nn)]])
|
| 64 |
+
|
|
|
|
|
|
|
| 65 |
with gr.Blocks(title="SD Models") as my_interface:
|
| 66 |
+
with gr.Column():
|
| 67 |
with gr.Row():
|
| 68 |
+
with gr.Column():
|
| 69 |
+
primary_prompt = gr.Textbox(label="Prompt", value="")
|
| 70 |
+
with gr.Column():
|
| 71 |
with gr.Row():
|
| 72 |
+
run = gr.Button("Run", variant="primary")
|
| 73 |
+
clear_btn = gr.Button("Clear")
|
| 74 |
with gr.Row():
|
| 75 |
sd_outputs = {}
|
| 76 |
model_idx = 1
|
|
|
|
| 81 |
pass
|
| 82 |
model_idx += 1
|
| 83 |
pass
|
|
|
|
| 84 |
|
| 85 |
with gr.Row(visible=False):
|
| 86 |
+
start_box = gr.Number(interactive=False)
|
| 87 |
+
end_box = gr.Number(interactive=False)
|
| 88 |
+
tog_box = gr.Textbox(value=0, interactive=False)
|
| 89 |
|
| 90 |
start_box.change(
|
| 91 |
all_task_end,
|
|
|
|
| 101 |
for model_path in models:
|
| 102 |
runs_dict[model_idx] = run.click(model_functions[model_idx], inputs=[primary_prompt], outputs=[sd_outputs[model_idx]])
|
| 103 |
model_idx += 1
|
|
|
|
|
|
|
| 104 |
|
| 105 |
clear_btn.click(
|
| 106 |
clear_fn,
|
|
|
|
| 114 |
cancels=[*list(runs_dict.values())])
|
| 115 |
|
| 116 |
my_interface.queue(concurrency_count=100, status_update_rate=1)
|
| 117 |
+
my_interface.launch(inline=True, show_api=False)
|