Hongyin Luo commited on
Commit
db1c120
·
1 Parent(s): 6e192d4

add application file

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import requests
4
+
5
+ import gradio as gr
6
+
7
+ server_url = os.environ["SERVER_URL"]
8
+
9
+ def chat(message, history):
10
+ data = {
11
+ "message": message,
12
+ "history": history
13
+ }
14
+
15
+ response = requests.post(
16
+ server_url,
17
+ json = data
18
+ ).json()
19
+
20
+ return response['response']
21
+
22
+ gradio_io = gr.ChatInterface(chat)
23
+ gradio_io.launch()