Update app.py
Browse files
app.py
CHANGED
@@ -12,13 +12,28 @@ output = query({
|
|
12 |
"inputs": "I like you. I love you",
|
13 |
})
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
# Gradio Interface
|
16 |
iface = gr.Interface(
|
17 |
-
fn=
|
18 |
inputs=[gr.Textbox(lines=2, label="Financial Statement")],
|
19 |
outputs=[
|
20 |
gr.Textbox(label="Sentiment"),
|
21 |
-
gr.Textbox(label="Advice")
|
22 |
],
|
23 |
live=True,
|
24 |
title="Financial Content Sentiment Analysis",
|
|
|
12 |
"inputs": "I like you. I love you",
|
13 |
})
|
14 |
|
15 |
+
|
16 |
+
# def predict_sentiment(payload):
|
17 |
+
# # Sentiment Analysis
|
18 |
+
# sentiment_inputs = sentiment_tokenizer(headline, padding=True, truncation=True, return_tensors='pt')
|
19 |
+
# with torch.no_grad():
|
20 |
+
# sentiment_outputs = sentiment_model(**sentiment_inputs)
|
21 |
+
# sentiment_prediction = torch.nn.functional.softmax(sentiment_outputs.logits, dim=-1)
|
22 |
+
|
23 |
+
# pos, neg, neutr = sentiment_prediction[:, 0].item(), sentiment_prediction[:, 1].item(), sentiment_prediction[:, 2].item()
|
24 |
+
# sentiment_label = "Positive" if pos > neg and pos > neutr else "Negative" if neg > pos and neg > neutr else "Neutral"
|
25 |
+
|
26 |
+
|
27 |
+
# return sentiment_label
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
# Gradio Interface
|
32 |
iface = gr.Interface(
|
33 |
+
fn=query,
|
34 |
inputs=[gr.Textbox(lines=2, label="Financial Statement")],
|
35 |
outputs=[
|
36 |
gr.Textbox(label="Sentiment"),
|
|
|
37 |
],
|
38 |
live=True,
|
39 |
title="Financial Content Sentiment Analysis",
|