import requests | |
API_URL = "https://api-inference.huggingface.co/models/ProsusAI/finbert" | |
headers = {"Authorization": "Bearer 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"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
output = query({ | |
"inputs": "I like you. I love you", | |
}) | |
# # Gradio Interface | |
# iface = gr.Interface( | |
# fn=predict_sentiment_and_stock_info, | |
# inputs=[gr.Textbox(lines=2, label="Financial Statement")], | |
# outputs=[ | |
# gr.Textbox(label="Sentiment"), | |
# gr.Textbox(label="Advice") | |
# ], | |
# live=True, | |
# title="Financial Content Sentiment Analysis", | |
# description="Enter a financial statement to analyze its sentiment." | |
# ) | |
# iface.launch() |