Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -110,12 +110,12 @@ df_cate = pd.DataFrame(categories)
|
|
110 |
# return gr.update(choices=list(df.columns))
|
111 |
|
112 |
|
113 |
-
def reset_cate(
|
114 |
-
if
|
115 |
-
|
116 |
else:
|
117 |
-
|
118 |
-
return
|
119 |
|
120 |
|
121 |
global value
|
@@ -270,7 +270,7 @@ with gr.Blocks() as demo:
|
|
270 |
|
271 |
#classification
|
272 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category, sl_treshold], outputs=[fi_excel, df_output])
|
273 |
-
btn_reset_df.click(reset_cate, inputs=
|
274 |
|
275 |
#charts
|
276 |
btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
|
|
|
110 |
# return gr.update(choices=list(df.columns))
|
111 |
|
112 |
|
113 |
+
def reset_cate(df_categories):
|
114 |
+
if df_categories.equals(df_cate):
|
115 |
+
df_categories = pd.DataFrame(columns=['topic', 'description', 'expert'])
|
116 |
else:
|
117 |
+
df_categories = df_cate.copy()
|
118 |
+
return df_categories
|
119 |
|
120 |
|
121 |
global value
|
|
|
270 |
|
271 |
#classification
|
272 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category, sl_treshold], outputs=[fi_excel, df_output])
|
273 |
+
btn_reset_df.click(reset_cate, inputs=df_category, outputs=df_category)
|
274 |
|
275 |
#charts
|
276 |
btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
|