GoalsAI / app.py
CosmoAI's picture
Update app.py
c1548d4
raw
history blame
551 Bytes
import google.generativeai as palm
import gradio as gr
import os
import json
# Set your API key
palm.configure(api_key=os.environ['PALM_KEY'])
# Select the PaLM 2 model
# model = 'models/text-bison-001'
def responsenew(data):
response = palm.chat(messages=data)
respo = {
"message": response.last,
"action": "nothing",
"function": "nothing"
}
print(data)
return json.dumps(respo)
gradio_interface = gr.Interface(
fn = responsenew,
inputs = "text",
outputs = "text"
)
gradio_interface.launch()