Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import google.generativeai as palm
|
| 2 |
-
import
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
# Set your API key
|
| 6 |
palm.configure(api_key=os.environ['PALM_KEY'])
|
|
@@ -9,10 +10,20 @@ palm.configure(api_key=os.environ['PALM_KEY'])
|
|
| 9 |
# model = 'models/text-bison-001'
|
| 10 |
|
| 11 |
|
| 12 |
-
|
| 13 |
-
response = palm.chat(messages=
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
|
|
|
| 1 |
import google.generativeai as palm
|
| 2 |
+
import gradio as gr
|
| 3 |
import os
|
| 4 |
+
import json
|
| 5 |
|
| 6 |
# Set your API key
|
| 7 |
palm.configure(api_key=os.environ['PALM_KEY'])
|
|
|
|
| 10 |
# model = 'models/text-bison-001'
|
| 11 |
|
| 12 |
|
| 13 |
+
def responsenew(data):
|
| 14 |
+
response = palm.chat(messages=data)
|
| 15 |
+
respo = {
|
| 16 |
+
"message": response.last,
|
| 17 |
+
"action": "nothing",
|
| 18 |
+
"function": "nothing"
|
| 19 |
+
}
|
| 20 |
+
print(data)
|
| 21 |
+
return json.dumps(respo)
|
| 22 |
|
| 23 |
+
gradio_interface = gr.Interface(
|
| 24 |
+
fn = responsenew,
|
| 25 |
+
inputs = "text",
|
| 26 |
+
outputs = "text"
|
| 27 |
+
)
|
| 28 |
+
gradio_interface.launch()
|
| 29 |
|