Spaces:
Runtime error
Runtime error
File size: 875 Bytes
271105e f32479d 271105e 7e04537 accdada 271105e 8407d4e 9e64ddd 8407d4e 2ce2f7b 271105e f32479d 3f0c66f 271105e 88e5e81 3f0c66f 271105e 29aa1d5 271105e 29aa1d5 271105e 8407d4e 271105e 247b2ad 271105e 8407d4e | 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 requests
import gradio as gr
import os
address = os.getenv("address")
thread = "new"
cc = "DUMY99"
def reset():
global thread
thread = "new"
def chat_history(message,history):
global thread
response = requests.post(address, json={
"query": message,
"thread": thread,
"cc": cc,
}).json()
thread = response['thread']
return response['result']
chat = gr.ChatInterface(
chat_history,
chatbot=gr.Chatbot(),
title="Grade Analyst",
description="Ask this bot any question about the csv",
theme="soft",
examples=["How many students are in the dataset? ", "How many students are at-risk, and how many of them are international students?"],
retry_btn=None,
undo_btn=None,
clear_btn="Clear",
)
with gr.Blocks() as demo:
chat.render()
gr.Button("Reset").click(reset)
demo.launch() |