Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -392,6 +392,14 @@ function refresh() {
|
|
392 |
}
|
393 |
}
|
394 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
395 |
|
396 |
with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
397 |
with gr.Tab("Methodology"):
|
@@ -457,20 +465,20 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
457 |
summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
|
458 |
|
459 |
sentiment_btn1 = gr.Button("Classify Financial Tone from PDF 1")
|
460 |
-
sentiment_textbox_1 = gr.Label(label="Classification for PDF 1")
|
461 |
|
462 |
# Classify the financial tone of the selected paragraph from PDF 1
|
463 |
sentiment_btn1.click(fn=lambda p: process_paragraph_1_sent(p), inputs=paragraph_1_dropdown, outputs=sentiment_textbox_1)
|
464 |
|
465 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
466 |
analyze_btn1 = gr.Button("With FinBERT-tone")
|
467 |
-
fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1")
|
468 |
|
469 |
# Analyze financial tone on each sentence using FinBERT-tone
|
470 |
analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
|
471 |
|
472 |
analyze_btn1_ = gr.Button("With ProsusAI/finbert")
|
473 |
-
fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)")
|
474 |
|
475 |
# Analyze financial tone using ProsusAI/finbert
|
476 |
analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
|
@@ -492,19 +500,19 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
492 |
summarize_btn2.click(fn=lambda p: process_paragraph_2_sum(p), inputs=paragraph_2_dropdown, outputs=summary_textbox_2)
|
493 |
|
494 |
sentiment_btn2 = gr.Button("Classify Financial Tone from PDF 2")
|
495 |
-
sentiment_textbox_2 = gr.Label(label="Classification for PDF 2")
|
496 |
|
497 |
# Classify the financial tone of the selected paragraph from PDF 2
|
498 |
sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
|
499 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
500 |
analyze_btn2 = gr.Button("With FinBERT-tone")
|
501 |
-
fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2")
|
502 |
|
503 |
# Analyze financial tone on each sentence using FinBERT-tone for PDF 2
|
504 |
analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
|
505 |
|
506 |
analyze_btn2_ = gr.Button("With ProsusAI/finbert")
|
507 |
-
fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)")
|
508 |
|
509 |
# Analyze financial tone using ProsusAI/finbert for PDF 2
|
510 |
analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
|
@@ -532,10 +540,10 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
532 |
|
533 |
with gr.Row():
|
534 |
with gr.Column():
|
535 |
-
sentiment_results_pdf1 = gr.HighlightedText(label="Sentiment Analysis - PDF 1")
|
536 |
|
537 |
with gr.Column():
|
538 |
-
sentiment_results_pdf2 = gr.HighlightedText(label="Sentiment Analysis - PDF 2")
|
539 |
|
540 |
with gr.Accordion("Adverse growth trends"):
|
541 |
with gr.Row():
|
|
|
392 |
}
|
393 |
}
|
394 |
"""
|
395 |
+
|
396 |
+
# Define custom colors for the labels
|
397 |
+
color_map = {
|
398 |
+
"Positive": "#00FF00", # Green for positive
|
399 |
+
"Neutral": "#0000FF", # Blue for neutral
|
400 |
+
"Negative": "#FF0000" # Red for negative
|
401 |
+
}
|
402 |
+
|
403 |
|
404 |
with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
405 |
with gr.Tab("Methodology"):
|
|
|
465 |
summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
|
466 |
|
467 |
sentiment_btn1 = gr.Button("Classify Financial Tone from PDF 1")
|
468 |
+
sentiment_textbox_1 = gr.Label(label="Classification for paragrapg from PDF 1")
|
469 |
|
470 |
# Classify the financial tone of the selected paragraph from PDF 1
|
471 |
sentiment_btn1.click(fn=lambda p: process_paragraph_1_sent(p), inputs=paragraph_1_dropdown, outputs=sentiment_textbox_1)
|
472 |
|
473 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
474 |
analyze_btn1 = gr.Button("With FinBERT-tone")
|
475 |
+
fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1",color_map=color_map)
|
476 |
|
477 |
# Analyze financial tone on each sentence using FinBERT-tone
|
478 |
analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
|
479 |
|
480 |
analyze_btn1_ = gr.Button("With ProsusAI/finbert")
|
481 |
+
fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)",color_map=color_map)
|
482 |
|
483 |
# Analyze financial tone using ProsusAI/finbert
|
484 |
analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
|
|
|
500 |
summarize_btn2.click(fn=lambda p: process_paragraph_2_sum(p), inputs=paragraph_2_dropdown, outputs=summary_textbox_2)
|
501 |
|
502 |
sentiment_btn2 = gr.Button("Classify Financial Tone from PDF 2")
|
503 |
+
sentiment_textbox_2 = gr.Label(label="Classification for paragraph from PDF 2")
|
504 |
|
505 |
# Classify the financial tone of the selected paragraph from PDF 2
|
506 |
sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
|
507 |
with gr.Accordion("Analyze Financial Tone on each sentence"):
|
508 |
analyze_btn2 = gr.Button("With FinBERT-tone")
|
509 |
+
fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2",color_map=color_map)
|
510 |
|
511 |
# Analyze financial tone on each sentence using FinBERT-tone for PDF 2
|
512 |
analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
|
513 |
|
514 |
analyze_btn2_ = gr.Button("With ProsusAI/finbert")
|
515 |
+
fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)",color_map=color_map)
|
516 |
|
517 |
# Analyze financial tone using ProsusAI/finbert for PDF 2
|
518 |
analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
|
|
|
540 |
|
541 |
with gr.Row():
|
542 |
with gr.Column():
|
543 |
+
sentiment_results_pdf1 = gr.HighlightedText(label="Sentiment Analysis - PDF 1",color_map=color_map)
|
544 |
|
545 |
with gr.Column():
|
546 |
+
sentiment_results_pdf2 = gr.HighlightedText(label="Sentiment Analysis - PDF 2",color_map=color_map)
|
547 |
|
548 |
with gr.Accordion("Adverse growth trends"):
|
549 |
with gr.Row():
|