import gradio as gr | |
import requests | |
API_URL = "https://api-inference.huggingface.co/models/ahmedrachid/FinancialBERT-Sentiment-Analysis" | |
headers = {"Authorization": "Bearer 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"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
def greet(text): | |
output = query({ | |
"inputs": text, | |
}) | |
return output | |
iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
iface.launch() |