Spaces:
Paused
Paused
File size: 1,040 Bytes
5a3ebe3 1967004 d6c8def 31cc919 d6c8def 4051f43 d6c8def 556b1ad eac07db |
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 |
import gradio as gr
import requests
#from transformers import AutoTokenizer
#tokenizer = AutoTokenizer.from_pretrained("liam168/c2-roberta-base-finetuned-dianping-chinese")
def chat(input):
url = 'http://dark.21cnai.com:5000/api/chat'
data = { "message": input }
headers = {"Content-Type": "Application/json","Authorization":"Bearer kdfjwoieskdflasdnf"}
response = requests.post(url, json=data, headers=headers)
print(response.text)
return response.text
css = '''
.input_text, .output_text {
font-family: Arial, sans-serif;
font-size: 16px;
}
.input_text:focus {
border: 2px solid #2C7BE5;
outline: none;
}
.output_text {
background-color: #F8F9FA;
border: 1px solid #CED4DA;
color: #495057;
}
.input_button {
background-color: #2C7BE5;
color: white;
font-weight: bold;
border: none;
}
'''
iface = gr.Interface(fn=chat, inputs="text", outputs="text",css=css)
iface.launch(server_name="0.0.0.0") |