sahil2801 commited on
Commit
68741d5
1 Parent(s): c172768

call banana

Browse files
Files changed (2) hide show
  1. app.py +15 -3
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,7 +1,19 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
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