Spaces:
Runtime error
Runtime error
File size: 758 Bytes
eb53a7c 3982cbb b23c5a6 3982cbb 3f19f89 b23c5a6 3f19f89 3982cbb dcb5cff 3982cbb 3f19f89 3982cbb 33dac06 3982cbb 33dac06 3982cbb 3f19f89 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import os
import requests
import gradio as gr
address = os.getenv("address")
thread = "new"
def reset():
global thread
thread = "new"
def chat_history(message,history):
global thread
response = requests.post(address, json={
"query": message,
"thread": thread,
"cc": "dummy"
}).json()
thread = response['thread']
return response['result']
chat = gr.ChatInterface(
chat_history,
chatbot=gr.Chatbot(),
title="GAIL v0.1",
description="Learn AI with AI",
theme="soft",
examples=["COURSE ROADMAP🚦", "LET'S BEGIN! 🚀 "],
retry_btn=None,
undo_btn=None,
clear_btn="Clear",
)
with gr.Blocks() as demo:
chat.render()
gr.Button("Reset").click(reset)
demo.launch()
|