Spaces:
Runtime error
Runtime error
File size: 575 Bytes
086be27 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
import requests
import os
API_URL = "https://api-inference.huggingface.co/models/cardiffnlp/twitter-roberta-base-sentiment"
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()
|