Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from classification import *
|
|
5 |
from chart_generation import *
|
6 |
from charts_advanced import *
|
7 |
from users_management import *
|
|
|
8 |
|
9 |
|
10 |
# Categories
|
@@ -148,6 +149,19 @@ with gr.Blocks() as demo:
|
|
148 |
plt_chart = gr.Plot(label="Graphique")
|
149 |
plt_chart2 = gr.Plot(label="Graphique")
|
150 |
plt_chart3 = gr.Plot(label="Graphique")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
with gr.Accordion("Excel Preview", open=False):
|
152 |
df_output = gr.DataFrame()
|
153 |
fi_excel = gr.File(label="Excel File")
|
@@ -157,12 +171,12 @@ with gr.Blocks() as demo:
|
|
157 |
tb_pwd.submit(auth_user, inputs=[tb_user, tb_pwd], outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
158 |
btn_logout.click(logout, inputs=None, outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
159 |
|
160 |
-
|
161 |
btn_search_status.click(extract_statuses, inputs=dd_url, outputs=dd_status)
|
162 |
btn_search.click(browse_folder, inputs=dd_url, outputs=dd_url)
|
163 |
dd_url.change(browse_folder, inputs=dd_url, outputs=dd_url)
|
164 |
#fi_excel.change(get_expert,inputs=fi_excel, outputs=dd_exp)
|
165 |
-
fi_excel.change(get_columns, inputs=[fi_excel], outputs=[dd_source_ask, dd_source_class, dd_label1, dd_label2, dd_searchcol, df_output])
|
166 |
|
167 |
btn_extract.click(extractionPrincipale, inputs=[dd_url, fi_excel, dd_status], outputs=[fi_excel])
|
168 |
|
@@ -171,6 +185,10 @@ with gr.Blocks() as demo:
|
|
171 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category], outputs=[fi_excel, df_output])
|
172 |
|
173 |
btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
|
|
|
|
|
|
|
|
|
174 |
|
175 |
btn_overall.click(generate_company_chart,inputs=[fi_excel], outputs=[plt_chart])
|
176 |
btn_overall.click(status_chart,inputs=[fi_excel], outputs=[plt_chart2])
|
|
|
5 |
from chart_generation import *
|
6 |
from charts_advanced import *
|
7 |
from users_management import *
|
8 |
+
from code_df_custom import *
|
9 |
|
10 |
|
11 |
# Categories
|
|
|
149 |
plt_chart = gr.Plot(label="Graphique")
|
150 |
plt_chart2 = gr.Plot(label="Graphique")
|
151 |
plt_chart3 = gr.Plot(label="Graphique")
|
152 |
+
|
153 |
+
with gr.Tab("Code on your file"):
|
154 |
+
with gr.Accordion("Input DataFrame Preview", open=False):
|
155 |
+
df_input = gr.DataFrame(interactive=False)
|
156 |
+
gr.Markdown("```python\ndf = pd.read_excel(YOUR_FILE)\n```")
|
157 |
+
cd_code = gr.Code(value="# Create a copy of the original DataFrame\nnew_df = df.copy()\n\n# Add a new column to the copy\nnew_df['NewColumn'] = 'New Value'", language='python')
|
158 |
+
gr.Markdown("```python\new_df.to_excel(YOUR_NEW_FILE)\nreturn YOUR_NEW_FILE\n```")
|
159 |
+
|
160 |
+
btn_run_code = gr.Button()
|
161 |
+
df_output = gr.DataFrame(interactive=False)
|
162 |
+
btn_export_df = gr.Button('Export df as excel')
|
163 |
+
st_filename = gr.State()
|
164 |
+
|
165 |
with gr.Accordion("Excel Preview", open=False):
|
166 |
df_output = gr.DataFrame()
|
167 |
fi_excel = gr.File(label="Excel File")
|
|
|
171 |
tb_pwd.submit(auth_user, inputs=[tb_user, tb_pwd], outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
172 |
btn_logout.click(logout, inputs=None, outputs=[st_user, md_username, dd_prompt, dd_keywords])
|
173 |
|
174 |
+
# 3GPP scraping
|
175 |
btn_search_status.click(extract_statuses, inputs=dd_url, outputs=dd_status)
|
176 |
btn_search.click(browse_folder, inputs=dd_url, outputs=dd_url)
|
177 |
dd_url.change(browse_folder, inputs=dd_url, outputs=dd_url)
|
178 |
#fi_excel.change(get_expert,inputs=fi_excel, outputs=dd_exp)
|
179 |
+
fi_excel.change(get_columns, inputs=[fi_excel], outputs=[dd_source_ask, dd_source_class, dd_label1, dd_label2, dd_searchcol, df_output,st_filename, df_input])
|
180 |
|
181 |
btn_extract.click(extractionPrincipale, inputs=[dd_url, fi_excel, dd_status], outputs=[fi_excel])
|
182 |
|
|
|
185 |
btn_classif.click(classification, inputs=[dd_source_class, fi_excel, df_category], outputs=[fi_excel, df_output])
|
186 |
|
187 |
btn_chart.click(create_bar_plot, inputs=[fi_excel, dd_label1, dd_label2], outputs=[plt_figure])
|
188 |
+
|
189 |
+
btn_run_code.click(run_code, inputs=[fi_excel, cd_code], outputs=[df_output])
|
190 |
+
btn_export_df.click(export_df, inputs=[df_output, st_filename], outputs=fi_excel)
|
191 |
+
|
192 |
|
193 |
btn_overall.click(generate_company_chart,inputs=[fi_excel], outputs=[plt_chart])
|
194 |
btn_overall.click(status_chart,inputs=[fi_excel], outputs=[plt_chart2])
|