File size: 731 Bytes
dba8da4
 
 
 
 
 
 
 
 
 
 
 
 
ec705bd
 
 
 
 
 
 
 
 
 
 
 
dba8da4
ec705bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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()