Spaces:
Sleeping
Sleeping
| """Demo interface with Gradio.""" | |
| import gradio as gr | |
| import requests | |
| def greet(text: str): | |
| """ | |
| Send the text to the model and return the probabilities | |
| """ | |
| # url = 'http://127.0.0.1:8000/classify/' | |
| url = 'https://modelapi-asxiavoigq-uc.a.run.app/classify/' | |
| data = {'user_input': text} | |
| response = requests.post(url, json=data, timeout=60) | |
| data = response.json() | |
| example = {i['label']: i['probability'] for i in data['probabilities']} | |
| return example | |
| demo = gr.Interface( | |
| fn=greet, | |
| inputs=gr.Text(label='Human entry'), | |
| outputs=gr.Label(num_top_classes=3, label='Probabilities'), | |
| allow_flagging='never' | |
| ) | |
| demo.launch() | |