Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
|
|
3 |
from transformers import pipeline
|
4 |
import spacy
|
5 |
import lib.read_pdf
|
@@ -654,11 +655,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 |
-
|
658 |
-
|
659 |
with gr.Row():
|
660 |
-
start =
|
661 |
-
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,5 +676,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()
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
+
from gradio_calendar import Calendar
|
4 |
from transformers import pipeline
|
5 |
import spacy
|
6 |
import lib.read_pdf
|
|
|
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 |
+
start_date = df['Date'].min()
|
659 |
+
end_date = df['Date'].max()
|
660 |
with gr.Row():
|
661 |
+
start = [Calendar(value =start_date, type="datetime", label="Start")],
|
662 |
+
end = [Calendar(value=end_date,type="datetime", label="End")],
|
663 |
apply_btn = gr.Button("Apply", scale=0)
|
664 |
reset_btn = gr.Button("Reset", scale=0)
|
665 |
# data_table = gr.DataFrame(value=df[['Date', 'Positive_ratio', 'Negative_ratio', 'Total_paragraphs']], label="Sentiment Data", height=500)
|
|
|
676 |
#color = 'Ratio_Type'
|
677 |
)
|
678 |
apply_btn.click(lambda start,end: gr.LinePlot(x_lim=[start, end]), [start, end], line_plot)
|
679 |
+
reset_btn.click(lambda : gr.LinePlot(x_lim=[start_date, end_date]), [], line_plot)
|
680 |
demo.launch()
|