Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
|
|
|
|
402 |
with gr.Column():
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
|
|
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"):
|