hackaithon101 / app.py
psteuer's picture
oooo
00e2a1f
raw history blame
No virus
575 Bytes
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()