Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
iface.launch(server_name="0.0.0.0")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
#from transformers import AutoTokenizer
|
| 4 |
+
#tokenizer = AutoTokenizer.from_pretrained("liam168/c2-roberta-base-finetuned-dianping-chinese")
|
| 5 |
+
def chat(input):
|
| 6 |
+
url = 'http://dark.21cnai.com:5000/api/chat'
|
| 7 |
+
data = { 'message': input }
|
| 8 |
+
headers = {'content-type': 'application/json','Authorization':'Bearer kdfjwoieskdflasdnf'}
|
| 9 |
+
response = requests.post(url, data=data, headers=headers)
|
| 10 |
+
return response
|
| 11 |
+
iface = gr.Interface(fn=chat, inputs="text", outputs=["text"])
|
| 12 |
iface.launch(server_name="0.0.0.0")
|