Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import os
|
3 |
|
4 |
api_key = os.environ.get("HUGGINGFACE_API_KEY")
|
@@ -23,11 +24,11 @@ default_model = "stabilityai/stable-diffusion-2"
|
|
23 |
model_name = gr.inputs.Dropdown(choices=model_list, label="Select Model", default=default_model)
|
24 |
|
25 |
def generate_image(text, model_name):
|
26 |
-
model = gr.
|
27 |
return model.predict(text)
|
28 |
|
29 |
input_text = gr.inputs.Textbox(label="Input Text")
|
30 |
-
output_image =
|
31 |
|
32 |
iface = gr.Interface(
|
33 |
fn=generate_image,
|
|
|
1 |
import gradio as gr
|
2 |
+
import gradio.components as comp
|
3 |
import os
|
4 |
|
5 |
api_key = os.environ.get("HUGGINGFACE_API_KEY")
|
|
|
24 |
model_name = gr.inputs.Dropdown(choices=model_list, label="Select Model", default=default_model)
|
25 |
|
26 |
def generate_image(text, model_name):
|
27 |
+
model = gr.Interface.load_model(model_name, source="huggingface", api_key=api_key)
|
28 |
return model.predict(text)
|
29 |
|
30 |
input_text = gr.inputs.Textbox(label="Input Text")
|
31 |
+
output_image = comp.Image(label="Generated Image")
|
32 |
|
33 |
iface = gr.Interface(
|
34 |
fn=generate_image,
|