Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -397,9 +397,9 @@ function refresh() {
|
|
| 397 |
|
| 398 |
# Define custom colors for the labels
|
| 399 |
color_map = {
|
| 400 |
-
"
|
| 401 |
-
"
|
| 402 |
-
"
|
| 403 |
}
|
| 404 |
|
| 405 |
|
|
@@ -474,13 +474,13 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
| 474 |
|
| 475 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
| 476 |
analyze_btn1 = gr.Button("With FinBERT-tone")
|
| 477 |
-
fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1",color_map=color_map)
|
| 478 |
|
| 479 |
# Analyze financial tone on each sentence using FinBERT-tone
|
| 480 |
analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
|
| 481 |
|
| 482 |
analyze_btn1_ = gr.Button("With ProsusAI/finbert")
|
| 483 |
-
fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)",color_map=color_map)
|
| 484 |
|
| 485 |
# Analyze financial tone using ProsusAI/finbert
|
| 486 |
analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
|
|
@@ -508,13 +508,13 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
| 508 |
sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
|
| 509 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
| 510 |
analyze_btn2 = gr.Button("With FinBERT-tone")
|
| 511 |
-
fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2",color_map=color_map)
|
| 512 |
|
| 513 |
# Analyze financial tone on each sentence using FinBERT-tone for PDF 2
|
| 514 |
analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
|
| 515 |
|
| 516 |
analyze_btn2_ = gr.Button("With ProsusAI/finbert")
|
| 517 |
-
fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)",color_map=color_map)
|
| 518 |
|
| 519 |
# Analyze financial tone using ProsusAI/finbert for PDF 2
|
| 520 |
analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
|
|
|
|
| 397 |
|
| 398 |
# Define custom colors for the labels
|
| 399 |
color_map = {
|
| 400 |
+
"Positive": "green", # Green for positive
|
| 401 |
+
"Neutral": "blue", # Blue for neutral
|
| 402 |
+
"Negative": "red" # Red for negative
|
| 403 |
}
|
| 404 |
|
| 405 |
|
|
|
|
| 474 |
|
| 475 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
| 476 |
analyze_btn1 = gr.Button("With FinBERT-tone")
|
| 477 |
+
fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1",color_map=color_map, show_legend=True)
|
| 478 |
|
| 479 |
# Analyze financial tone on each sentence using FinBERT-tone
|
| 480 |
analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
|
| 481 |
|
| 482 |
analyze_btn1_ = gr.Button("With ProsusAI/finbert")
|
| 483 |
+
fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)",color_map=color_map, show_legend=True)
|
| 484 |
|
| 485 |
# Analyze financial tone using ProsusAI/finbert
|
| 486 |
analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
|
|
|
|
| 508 |
sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
|
| 509 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
| 510 |
analyze_btn2 = gr.Button("With FinBERT-tone")
|
| 511 |
+
fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2",color_map=color_map, show_legend=True)
|
| 512 |
|
| 513 |
# Analyze financial tone on each sentence using FinBERT-tone for PDF 2
|
| 514 |
analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
|
| 515 |
|
| 516 |
analyze_btn2_ = gr.Button("With ProsusAI/finbert")
|
| 517 |
+
fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)",color_map=color_map, show_legend=True)
|
| 518 |
|
| 519 |
# Analyze financial tone using ProsusAI/finbert for PDF 2
|
| 520 |
analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
|