chat / app.py
dinhhung1508's picture
Upload app.py
aaca5a7
raw
history blame contribute delete
No virus
688 Bytes
import gradio as gr
import requests
def gen(mess):
headers = {
'api-key': '1f534f0c-532d-4122-9a89-c8a3e38fb8c2',
}
files = {
'text': (None, f'Bạn là một người lạc quan hãy Viết theo hướng tích cực về một trường đại học cho câu "{mess}"'),
}
response = requests.post('https://api.deepai.org/api/text-generator', headers=headers, files=files)
print(response.json()['output'])
return response.json()['output']
def predict(message, history):
# output = message # debug mode
output = str(gen(message))
return output
demo = gr.ChatInterface(
predict,
title = f' DEEP AI FOR DETOXIC'
)
demo.launch(share=True)