Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -654,11 +654,11 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
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()
|
658 |
-
end_date = df['Date'].max()
|
659 |
with gr.Row():
|
660 |
-
start = gr.DateTime(
|
661 |
-
end = gr.DateTime(
|
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,5 +675,5 @@ with gr.Blocks(theme='gradio/soft',js=js_func) as demo:
|
|
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=[
|
679 |
demo.launch()
|
|
|
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()
|
658 |
+
#end_date = df['Date'].max()
|
659 |
with gr.Row():
|
660 |
+
start = gr.DateTime("2008-01-01 00:00:00", label="Start")
|
661 |
+
end = gr.DateTime("2025-01-01 00:00:00", 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=["2008-01-01 00:00:00", "2025-01-01 00:00:00"]), [], line_plot)
|
679 |
demo.launch()
|