Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -234,7 +234,7 @@ def process_and_compare(file1, sheet1, file2, sheet2):
|
|
234 |
plt.savefig(file_path, format='png', bbox_inches='tight')
|
235 |
plt.close()
|
236 |
|
237 |
-
return
|
238 |
|
239 |
def find_sentences_with_keywords(text, keywords):
|
240 |
# Split text into sentences using regular expression to match sentence-ending punctuation
|
@@ -554,8 +554,14 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
554 |
sheet = gr.Dropdown(choices=["GDP", "HICP", "RRE prices", "Unemployment", "CRE prices"], label="Select Sheet for File 1 and 2")
|
555 |
|
556 |
with gr.Column():
|
557 |
-
result = gr.Image(label="Comparison pLot")
|
558 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
def update_sheets(file):
|
560 |
return get_sheet_names(file)
|
561 |
|
@@ -587,7 +593,7 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
587 |
inputs=[country_2_dropdown, sheet],
|
588 |
outputs=text_result_df2)
|
589 |
# Button to extract text from PDFs and perform sentiment analysis
|
590 |
-
b1.click(fn=process_and_compare, inputs=[file1, sheet, file2, sheet], outputs=[result,country_1_dropdown, country_2_dropdown])
|
591 |
b2.click(fn=process_pdfs_and_analyze_sentiment, inputs=[file1, file2, sheet], outputs=[sentiment_results_pdf1, sentiment_results_pdf2])
|
592 |
|
593 |
|
|
|
234 |
plt.savefig(file_path, format='png', bbox_inches='tight')
|
235 |
plt.close()
|
236 |
|
237 |
+
return merged_df, f'Histogram of Difference between Adverse cumulative growth of {year2} and {year1} for {sheet1}', gr.update(choices=stored_df1.Country.values.tolist()), gr.update(choices=stored_df2.Country.values.tolist())
|
238 |
|
239 |
def find_sentences_with_keywords(text, keywords):
|
240 |
# Split text into sentences using regular expression to match sentence-ending punctuation
|
|
|
554 |
sheet = gr.Dropdown(choices=["GDP", "HICP", "RRE prices", "Unemployment", "CRE prices"], label="Select Sheet for File 1 and 2")
|
555 |
|
556 |
with gr.Column():
|
557 |
+
#result = gr.Image(label="Comparison pLot")
|
558 |
+
result = gr.BarPlot(
|
559 |
+
pd.DataFrame(columns=["Country", "Difference adverse cumulative growth"]),
|
560 |
+
x="Country",
|
561 |
+
y="Difference adverse cumulative growth",
|
562 |
+
color="Country",
|
563 |
+
x_bin=1,
|
564 |
+
)
|
565 |
def update_sheets(file):
|
566 |
return get_sheet_names(file)
|
567 |
|
|
|
593 |
inputs=[country_2_dropdown, sheet],
|
594 |
outputs=text_result_df2)
|
595 |
# Button to extract text from PDFs and perform sentiment analysis
|
596 |
+
b1.click(fn=process_and_compare, inputs=[file1, sheet, file2, sheet], outputs=[result, result.title,country_1_dropdown, country_2_dropdown])
|
597 |
b2.click(fn=process_pdfs_and_analyze_sentiment, inputs=[file1, file2, sheet], outputs=[sentiment_results_pdf1, sentiment_results_pdf2])
|
598 |
|
599 |
|