Spaces:
Runtime error
Runtime error
call banana
Browse files- app.py +15 -3
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
iface = gr.Interface(fn=
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import banana_dev as banana
|
3 |
+
import os
|
4 |
+
api_key = os.getenv("API_KEY")
|
5 |
+
model_key = os.getenv("MODEL_KEY")
|
6 |
+
def call_model(prompt):
|
7 |
+
model_parameters = {
|
8 |
+
"prompt": prompt,
|
9 |
+
"max_length":1000
|
10 |
|
11 |
+
}
|
12 |
+
out = banana.run(api_key, model_key, model_parameters)
|
13 |
+
if out.message!="success":
|
14 |
+
return "error"
|
15 |
+
|
16 |
+
return out["modelOutputs"][0]["output"]
|
17 |
|
18 |
+
iface = gr.Interface(fn=call_model, inputs="text", outputs="text")
|
19 |
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
banana-dev
|