Chat / app.py
CosmoAI's picture
Update app.py
84ab7d1
raw
history blame
1.06 kB
import gradio as gr
import requests
import time
import os
import json
genai.configure(
api_key=os.environ['API_KEY'])
model = genai.GenerativeModel(
model_name='gemini-pro')
def bardChat(data):
return json.dumps(respo)
def responsenew(data):
print(data)
return bardChat(data)
gradio_interface = gr.Interface(
fn = responsenew,
inputs = "text",
outputs = "text"
)
gradio_interface.launch()
# remind_val = ["create a reminder", "create reminder", "remind me"]
# if remind_val in data:
# return "Reminder created!"
# else:
# return bardChat(data)
# with gr.Blocks() as demo:
# chatbot = gr.Chatbot()
# msg = gr.Textbox()
# clear = gr.ClearButton([msg, chatbot])
# def respond(message, chat_history):
# bot_message = responsenew(message)
# chat_history.append((message, bot_message))
# time.sleep(2)
# return "", chat_history
# msg.submit(respond, [msg, chatbot], [msg, chatbot])
# if __name__ == "__main__":
# demo.launch()