Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,18 +21,17 @@ for model in models:
|
|
21 |
loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
|
22 |
models2.append(loaded_model)
|
23 |
|
24 |
-
|
|
|
|
|
25 |
|
26 |
def set_model(current_model_index):
|
27 |
global current_model
|
28 |
-
|
29 |
return f"{current_model['name']}"
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
proc = models2[model_choice]
|
34 |
-
return proc(inputs)
|
35 |
-
|
36 |
|
37 |
with gr.Blocks() as myface:
|
38 |
gr.HTML(
|
@@ -44,11 +43,12 @@ with gr.Blocks() as myface:
|
|
44 |
input_text = gr.Textbox(label="Prompt idea", placeholder="", lines=1)
|
45 |
# Model selection dropdown
|
46 |
model_name1 = gr.Dropdown(
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
52 |
)
|
53 |
|
54 |
run = gr.Button("Generate Images", variant="primary")
|
@@ -56,7 +56,7 @@ with gr.Blocks() as myface:
|
|
56 |
with gr.Row():
|
57 |
output1 = gr.Image(label="")
|
58 |
|
59 |
-
|
60 |
|
61 |
|
62 |
run.click(send_it, inputs=[input_text, model_name1], outputs=[output1])
|
|
|
21 |
loaded_model = gr.Interface.load(model_url, live=True, preprocess=True)
|
22 |
models2.append(loaded_model)
|
23 |
|
24 |
+
def send_it(inputs, model_choice):
|
25 |
+
proc = models2[model_choice]
|
26 |
+
return proc(inputs)
|
27 |
|
28 |
def set_model(current_model_index):
|
29 |
global current_model
|
30 |
+
current_model = models[current_model_index]
|
31 |
return f"{current_model['name']}"
|
32 |
|
33 |
+
def dropdown_change():
|
34 |
+
send_it(input_text.value, model_name1.value)
|
|
|
|
|
|
|
35 |
|
36 |
with gr.Blocks() as myface:
|
37 |
gr.HTML(
|
|
|
43 |
input_text = gr.Textbox(label="Prompt idea", placeholder="", lines=1)
|
44 |
# Model selection dropdown
|
45 |
model_name1 = gr.Dropdown(
|
46 |
+
label="Choose Model",
|
47 |
+
choices=[m["name"] for m in models],
|
48 |
+
type="index",
|
49 |
+
value=current_model["name"],
|
50 |
+
interactive=True,
|
51 |
+
update=dropdown_change
|
52 |
)
|
53 |
|
54 |
run = gr.Button("Generate Images", variant="primary")
|
|
|
56 |
with gr.Row():
|
57 |
output1 = gr.Image(label="")
|
58 |
|
59 |
+
model_name1.change(set_model, inputs=model_name1, outputs=[output1])
|
60 |
|
61 |
|
62 |
run.click(send_it, inputs=[input_text, model_name1], outputs=[output1])
|