Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,14 +17,14 @@ models = [
|
|
| 17 |
"models/stabilityai/stable-diffusion-2-1-unclip-small"
|
| 18 |
]
|
| 19 |
|
| 20 |
-
def
|
| 21 |
-
gr.Interface.load(model_name
|
|
|
|
| 22 |
|
| 23 |
-
model_dropdown = gr.inputs.Dropdown(models)
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
-
if api_key:
|
| 28 |
-
interface.api_key = api_key
|
| 29 |
|
| 30 |
interface.launch()
|
|
|
|
| 17 |
"models/stabilityai/stable-diffusion-2-1-unclip-small"
|
| 18 |
]
|
| 19 |
|
| 20 |
+
def generate_text(model_name, input_text):
|
| 21 |
+
model = gr.Interface.load(model_name, api_key=os.getenv("HUGGINGFACE_API_KEY"))
|
| 22 |
+
return model.process(input_text)
|
| 23 |
|
| 24 |
+
model_dropdown = gr.inputs.Dropdown(models, label="Select Model")
|
| 25 |
+
input_text = gr.inputs.Textbox(lines=5, label="Input Text")
|
| 26 |
+
output_text = gr.outputs.Textbox(label="Output Text")
|
| 27 |
|
| 28 |
+
interface = gr.Interface(fn=generate_text, inputs=[model_dropdown, input_text], outputs=output_text)
|
|
|
|
|
|
|
| 29 |
|
| 30 |
interface.launch()
|