Cachoups commited on
Commit
d72a722
·
verified ·
1 Parent(s): 137833b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -58
app.py CHANGED
@@ -371,65 +371,68 @@ with gr.Blocks() as demo:
371
  with gr.Row():
372
  # PDF 1 Analysis section with custom background
373
  with gr.Column():
374
- with gr.Box():
375
- gr.Markdown("<div class='pdf1-analysis'><h3>PDF 1 Analysis</h3></div>")
376
- selected_paragraph_1 = gr.Textbox(label="Selected Paragraph 1 Content", lines=4)
377
- summarize_btn1 = gr.Button("Summarize Text from PDF 1")
378
- summary_textbox_1 = gr.Textbox(label="Summary for PDF 1", lines=2)
379
-
380
- # Summarize the selected paragraph from PDF 1
381
- summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
382
-
383
- sentiment_btn1 = gr.Button("Classify Financial Tone from PDF 1")
384
- sentiment_textbox_1 = gr.Textbox(label="Classification for PDF 1", lines=1)
385
-
386
- # Classify the financial tone of the selected paragraph from PDF 1
387
- sentiment_btn1.click(fn=lambda p: process_paragraph_1_sent(p), inputs=paragraph_1_dropdown, outputs=sentiment_textbox_1)
388
-
389
- analyze_btn1 = gr.Button("Analyze Financial Tone on each sentence with FinBERT-tone")
390
- fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1")
391
-
392
- # Analyze financial tone on each sentence using FinBERT-tone
393
- analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
394
-
395
- analyze_btn1_ = gr.Button("Analyze Financial Tone on each sentence with ProsusAI/finbert")
396
- fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)")
397
-
398
- # Analyze financial tone using ProsusAI/finbert
399
- analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
400
-
401
- # PDF 2 Analysis section with custom background
 
 
402
  with gr.Column():
403
- with gr.Box():
404
- gr.Markdown("<div class='pdf2-analysis'><h3>PDF 2 Analysis</h3></div>")
405
- selected_paragraph_2 = gr.Textbox(label="Selected Paragraph 2 Content", lines=4)
406
-
407
- # Display selected paragraph from PDF 2
408
- selected_paragraph_2.change(fn=show, inputs=paragraph_2_dropdown, outputs=selected_paragraph_2)
409
-
410
- summarize_btn2 = gr.Button("Summarize Text from PDF 2")
411
- summary_textbox_2 = gr.Textbox(label="Summary for PDF 2", lines=2)
412
-
413
- # Summarize the selected paragraph from PDF 2
414
- summarize_btn2.click(fn=lambda p: process_paragraph_2_sum(p), inputs=paragraph_2_dropdown, outputs=summary_textbox_2)
415
-
416
- sentiment_btn2 = gr.Button("Classify Financial Tone from PDF 2")
417
- sentiment_textbox_2 = gr.Textbox(label="Classification for PDF 2", lines=1)
418
-
419
- # Classify the financial tone of the selected paragraph from PDF 2
420
- sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
421
-
422
- analyze_btn2 = gr.Button("Analyze Financial Tone on each sentence with FinBERT-tone")
423
- fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2")
424
-
425
- # Analyze financial tone on each sentence using FinBERT-tone for PDF 2
426
- analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
427
-
428
- analyze_btn2_ = gr.Button("Analyze Financial Tone on each sentence with ProsusAI/finbert")
429
- fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)")
430
-
431
- # Analyze financial tone using ProsusAI/finbert for PDF 2
432
- analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
 
433
 
434
 
435
  with gr.Tab("Financial Report Table Analysis"):
 
371
  with gr.Row():
372
  # PDF 1 Analysis section with custom background
373
  with gr.Column():
374
+ gr.Markdown("<div class='pdf1-analysis'><h3>PDF 1 Analysis</h3></div>")
375
+ gr.Markdown("### PDF 1 Analysis")
376
+
377
+ selected_paragraph_1 = gr.Textbox(label="Selected Paragraph 1 Content", lines=4)
378
+
379
+ summarize_btn1 = gr.Button("Summarize Text from PDF 1")
380
+ summary_textbox_1 = gr.Textbox(label="Summary for PDF 1", lines=2)
381
+
382
+ # Summarize the selected paragraph from PDF 1
383
+ summarize_btn1.click(fn=lambda p: process_paragraph_1_sum(p), inputs=paragraph_1_dropdown, outputs=summary_textbox_1)
384
+
385
+ sentiment_btn1 = gr.Button("Classify Financial Tone from PDF 1")
386
+ sentiment_textbox_1 = gr.Textbox(label="Classification for PDF 1", lines=1)
387
+
388
+ # Classify the financial tone of the selected paragraph from PDF 1
389
+ sentiment_btn1.click(fn=lambda p: process_paragraph_1_sent(p), inputs=paragraph_1_dropdown, outputs=sentiment_textbox_1)
390
+
391
+ analyze_btn1 = gr.Button("Analyze Financial Tone on each sentence with FinBERT-tone")
392
+ fin_spans_1 = gr.HighlightedText(label="Financial Tone Analysis for PDF 1")
393
+
394
+ # Analyze financial tone on each sentence using FinBERT-tone
395
+ analyze_btn1.click(fn=lambda p: process_paragraph_1_sent_tone(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1)
396
+
397
+ analyze_btn1_ = gr.Button("Analyze Financial Tone on each sentence with ProsusAI/finbert")
398
+ fin_spans_1_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 1 (Bis)")
399
+
400
+ # Analyze financial tone using ProsusAI/finbert
401
+ analyze_btn1_.click(fn=lambda p: process_paragraph_1_sent_tone_bis(p), inputs=paragraph_1_dropdown, outputs=fin_spans_1_)
402
+
403
+ # Process the selected paragraph from PDF 2
404
  with gr.Column():
405
+ gr.Markdown("<div class='pdf2-analysis'><h3>PDF 2 Analysis</h3></div>")
406
+ gr.Markdown("### PDF 2 Analysis")
407
+
408
+ selected_paragraph_2 = gr.Textbox(label="Selected Paragraph 2 Content", lines=4)
409
+
410
+ # Display selected paragraph from PDF 2
411
+ selected_paragraph_2.change(fn=show, inputs=paragraph_2_dropdown, outputs=selected_paragraph_2)
412
+
413
+ summarize_btn2 = gr.Button("Summarize Text from PDF 2")
414
+ summary_textbox_2 = gr.Textbox(label="Summary for PDF 2", lines=2)
415
+
416
+ # Summarize the selected paragraph from PDF 2
417
+ summarize_btn2.click(fn=lambda p: process_paragraph_2_sum(p), inputs=paragraph_2_dropdown, outputs=summary_textbox_2)
418
+
419
+ sentiment_btn2 = gr.Button("Classify Financial Tone from PDF 2")
420
+ sentiment_textbox_2 = gr.Textbox(label="Classification for PDF 2", lines=1)
421
+
422
+ # Classify the financial tone of the selected paragraph from PDF 2
423
+ sentiment_btn2.click(fn=lambda p: process_paragraph_2_sent(p), inputs=paragraph_2_dropdown, outputs=sentiment_textbox_2)
424
+
425
+ analyze_btn2 = gr.Button("Analyze Financial Tone on each sentence with FinBERT-tone")
426
+ fin_spans_2 = gr.HighlightedText(label="Financial Tone Analysis for PDF 2")
427
+
428
+ # Analyze financial tone on each sentence using FinBERT-tone for PDF 2
429
+ analyze_btn2.click(fn=lambda p: process_paragraph_2_sent_tone(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2)
430
+
431
+ analyze_btn2_ = gr.Button("Analyze Financial Tone on each sentence with ProsusAI/finbert")
432
+ fin_spans_2_ = gr.HighlightedText(label="Financial Tone Analysis for PDF 2 (Bis)")
433
+
434
+ # Analyze financial tone using ProsusAI/finbert for PDF 2
435
+ analyze_btn2_.click(fn=lambda p: process_paragraph_2_sent_tone_bis(p), inputs=paragraph_2_dropdown, outputs=fin_spans_2_)
436
 
437
 
438
  with gr.Tab("Financial Report Table Analysis"):