Spaces:
Runtime error
Runtime error
Download app.py from QL2023/Grade_Analyst: direct link, hf CLI and curl.
- Browser
- Download file 875 Bytes
-
https://huggingface.co/spaces/QL2023/Grade_Analyst/resolve/main/app.py
- Command line
-
hf download hf://spaces/QL2023/Grade_Analyst/app.py
-
curl -L -o app.py https://huggingface.co/spaces/QL2023/Grade_Analyst/resolve/main/app.py
875 Bytes
| 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() |