Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1524,19 +1524,26 @@ with gr.Blocks(css=css, title="DataSynth — Analytics Hub") as demo:
|
|
| 1524 |
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
| 1525 |
df.to_csv(tmp.name, index=False)
|
| 1526 |
# prepare choices for date and target selectors
|
| 1527 |
-
|
| 1528 |
# save df to temp csv for persistence (store path in state)
|
| 1529 |
#tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
| 1530 |
#df.to_csv(tmp.name, index=False)
|
| 1531 |
|
| 1532 |
-
return (md, df.head(100), tmp.name, prof, corr_plot_fig)
|
| 1533 |
except Exception as e:
|
| 1534 |
return (gr.update(value=f"Error loading file: {e}"),
|
| 1535 |
pd.DataFrame(), None, None, None)
|
| 1536 |
|
| 1537 |
-
profile_btn.click(
|
| 1538 |
-
|
| 1539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1540 |
|
| 1541 |
#def _view_data(uploaded):
|
| 1542 |
# try:
|
|
|
|
| 1524 |
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
| 1525 |
df.to_csv(tmp.name, index=False)
|
| 1526 |
# prepare choices for date and target selectors
|
| 1527 |
+
prepare_updates = update_column_lists(df)
|
| 1528 |
# save df to temp csv for persistence (store path in state)
|
| 1529 |
#tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
| 1530 |
#df.to_csv(tmp.name, index=False)
|
| 1531 |
|
| 1532 |
+
return (md, df.head(100), tmp.name, prof, corr_plot_fig, *prepare_updates)
|
| 1533 |
except Exception as e:
|
| 1534 |
return (gr.update(value=f"Error loading file: {e}"),
|
| 1535 |
pd.DataFrame(), None, None, None)
|
| 1536 |
|
| 1537 |
+
profile_btn.click(
|
| 1538 |
+
fn=_load_and_profile,
|
| 1539 |
+
inputs=[upload],
|
| 1540 |
+
outputs=[
|
| 1541 |
+
profile_md, sample_table, df_state, profile_state, corr_plot,
|
| 1542 |
+
available_cols, rename_col_old, dtype_col, num_impute_cols,
|
| 1543 |
+
cat_impute_cols, replace_col, split_col, date_col_selected, pivot_index,
|
| 1544 |
+
text_ops_cols, groupby_cols, agg_columns, pivot_columns, pivot_values, join_key
|
| 1545 |
+
]
|
| 1546 |
+
)
|
| 1547 |
|
| 1548 |
#def _view_data(uploaded):
|
| 1549 |
# try:
|