Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -649,15 +649,16 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
649 |
with gr.Tab("Fed data analysis"):
|
650 |
gr.Markdown("## Sentiment Analysis Overview")
|
651 |
# Display DataFrame
|
652 |
-
apply_btn = gr.Button("Apply", scale=0)
|
653 |
df = pd.read_csv("data/2008_2024_minutes.csv", header = 0)
|
654 |
df['Total_paragraphs']=df['Total_paragraphs']-df['Neutral']
|
655 |
df['Positive_ratio'] = df['Positive'] / df['Total_paragraphs']*100
|
656 |
df['Negative_ratio'] = df['Negative'] / df['Total_paragraphs']*100
|
657 |
df['Date'] = pd.to_datetime(df['Date'])
|
|
|
|
|
658 |
with gr.Row():
|
659 |
-
start = gr.DateTime(
|
660 |
-
end = gr.DateTime(
|
661 |
apply_btn = gr.Button("Apply", scale=0)
|
662 |
reset_btn = gr.Button("Reset", scale=0)
|
663 |
# data_table = gr.DataFrame(value=df[['Date', 'Positive_ratio', 'Negative_ratio', 'Total_paragraphs']], label="Sentiment Data", height=500)
|
@@ -674,5 +675,5 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
674 |
#color = 'Ratio_Type'
|
675 |
)
|
676 |
apply_btn.click(lambda start,end: gr.LinePlot(x_lim=[start, end]), [start, end], line_plot)
|
677 |
-
reset_btn.click(lambda : gr.LinePlot(x_lim=[
|
678 |
demo.launch()
|
|
|
649 |
with gr.Tab("Fed data analysis"):
|
650 |
gr.Markdown("## Sentiment Analysis Overview")
|
651 |
# Display DataFrame
|
|
|
652 |
df = pd.read_csv("data/2008_2024_minutes.csv", header = 0)
|
653 |
df['Total_paragraphs']=df['Total_paragraphs']-df['Neutral']
|
654 |
df['Positive_ratio'] = df['Positive'] / df['Total_paragraphs']*100
|
655 |
df['Negative_ratio'] = df['Negative'] / df['Total_paragraphs']*100
|
656 |
df['Date'] = pd.to_datetime(df['Date'])
|
657 |
+
start_date = df['Date'].min().to_pydatetime()
|
658 |
+
end_date = df['Date'].max().to_pydatetime()
|
659 |
with gr.Row():
|
660 |
+
start = gr.DateTime(start_date, label="Start")
|
661 |
+
end = gr.DateTime(end_date, label="End")
|
662 |
apply_btn = gr.Button("Apply", scale=0)
|
663 |
reset_btn = gr.Button("Reset", scale=0)
|
664 |
# data_table = gr.DataFrame(value=df[['Date', 'Positive_ratio', 'Negative_ratio', 'Total_paragraphs']], label="Sentiment Data", height=500)
|
|
|
675 |
#color = 'Ratio_Type'
|
676 |
)
|
677 |
apply_btn.click(lambda start,end: gr.LinePlot(x_lim=[start, end]), [start, end], line_plot)
|
678 |
+
reset_btn.click(lambda : gr.LinePlot(x_lim=[start_date, end_date]), [], line_plot)
|
679 |
demo.launch()
|