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()