QL2023 commited on
Commit
3982cbb
·
verified ·
1 Parent(s): 2214bc8

Upload app_gail.py

Browse files
Files changed (1) hide show
  1. app_gail.py +32 -0
app_gail.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import gradio as gr
3
+ import os
4
+
5
+ address = os.getenv("address")
6
+
7
+ thread = 0
8
+
9
+ def chat_history(message,history):
10
+
11
+ global thread
12
+
13
+ response = requests.post(address, json={
14
+ "query": message,
15
+ "thread": thread,
16
+ }).json()
17
+
18
+ thread = response['thread']
19
+
20
+ return response['result']
21
+
22
+ gr.ChatInterface(
23
+ chat_history,
24
+ chatbot=gr.Chatbot(),
25
+ title="Grade Analyst",
26
+ description="Ask this bot any question about the csv",
27
+ theme="soft",
28
+ examples=["How many students are there?", "What's the average score for course total?"],
29
+ retry_btn=None,
30
+ undo_btn=None,
31
+ clear_btn="Clear",
32
+ ).launch()