Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import requests | |
| import os | |
| API_URL = "https://api-inference.huggingface.co/models/cardiffnlp/twitter-roberta-base-sentiment-latest" | |
| bt = os.environ['HACKAITHONBEARERTOKEN'] | |
| headers = {"Authorization": bt } | |
| def query(data): | |
| response = requests.post(API_URL, headers=headers, json=data) | |
| return "V2"+str(response.json()) | |
| def greet(howareyoufeeling): | |
| output = query({"inputs":howareyoufeeling}) | |
| print (str(output)) | |
| return str(output) | |
| iface = gr.Interface( | |
| fn=greet, inputs=["text"], outputs="text", allow_flagging="never") | |
| iface.launch() | |