Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
import os
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
models = [
|
5 |
"models/stabilityai/stable-diffusion-xl-base-0.9",
|
@@ -17,22 +17,9 @@ models = [
|
|
17 |
"models/stabilityai/stable-diffusion-2-1-unclip-small"
|
18 |
]
|
19 |
|
20 |
-
def
|
21 |
-
|
22 |
-
output_image = model.process(input_text)
|
23 |
-
return output_image
|
24 |
|
25 |
-
model_dropdown =
|
26 |
-
|
27 |
-
output_image = gr.outputs.Image(label="Output Image")
|
28 |
-
|
29 |
-
def change_model(model_name):
|
30 |
-
global interface
|
31 |
-
interface.close()
|
32 |
-
interface = gr.Interface(generate_image, inputs=[model_name, input_text], outputs=output_image)
|
33 |
-
interface.launch()
|
34 |
-
|
35 |
-
interface = gr.Interface(generate_image, inputs=[model_dropdown, input_text], outputs=output_image, capture_session=True)
|
36 |
-
|
37 |
-
change_model_button = gr.Interface.load("models/stabilityai/stable-diffusion-2", capture_session=True).launch()
|
38 |
interface.launch()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio import components
|
3 |
|
4 |
models = [
|
5 |
"models/stabilityai/stable-diffusion-xl-base-0.9",
|
|
|
17 |
"models/stabilityai/stable-diffusion-2-1-unclip-small"
|
18 |
]
|
19 |
|
20 |
+
def choose_model(model_name):
|
21 |
+
gr.Interface.load(model_name).launch()
|
|
|
|
|
22 |
|
23 |
+
model_dropdown = components.Dropdown(models)
|
24 |
+
interface = gr.Interface(fn=choose_model, inputs=model_dropdown, outputs=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
interface.launch()
|