Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,40 +46,19 @@ def safe_read_csv(filename, nrows=None):
|
|
| 46 |
except Exception:
|
| 47 |
return pd.DataFrame()
|
| 48 |
|
| 49 |
-
|
| 50 |
def run_notebook(nb_name: str) -> str:
|
| 51 |
-
|
| 52 |
-
nb_in = BASE_DIR / nb_name
|
| 53 |
-
if not nb_in.exists():
|
| 54 |
-
return f"ERROR: {nb_name} not found."
|
| 55 |
-
|
| 56 |
-
nb_out = RUNS_DIR / f"run_{stamp()}_{nb_name}"
|
| 57 |
-
pm.execute_notebook(
|
| 58 |
-
input_path=str(nb_in),
|
| 59 |
-
output_path=str(nb_out),
|
| 60 |
-
cwd=str(BASE_DIR),
|
| 61 |
-
log_output=True,
|
| 62 |
-
progress_bar=False,
|
| 63 |
-
execution_timeout=PAPERMILL_TIMEOUT,
|
| 64 |
-
)
|
| 65 |
-
return f"Executed {nb_name}"
|
| 66 |
-
|
| 67 |
|
| 68 |
def run_datacreation():
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
|
| 77 |
def run_pythonanalysis():
|
| 78 |
-
|
| 79 |
-
log = run_notebook(NB2)
|
| 80 |
-
return f"OK - {log}\n\nAnalysis notebook completed."
|
| 81 |
-
except Exception as e:
|
| 82 |
-
return f"FAILED - {e}\n\n{traceback.format_exc()[-2000:]}"
|
| 83 |
|
| 84 |
|
| 85 |
def run_full_pipeline():
|
|
|
|
| 46 |
except Exception:
|
| 47 |
return pd.DataFrame()
|
| 48 |
|
|
|
|
| 49 |
def run_notebook(nb_name: str) -> str:
|
| 50 |
+
return f"Notebook '{nb_name}' execution disabled in this deployed app."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
def run_datacreation():
|
| 53 |
+
csvs = sorted([f.name for f in BASE_DIR.glob("*.csv")])
|
| 54 |
+
return (
|
| 55 |
+
"Data already generated and available.\n\n"
|
| 56 |
+
"Available CSV files:\n" +
|
| 57 |
+
"\n".join(f"- {c}" for c in csvs)
|
| 58 |
+
)
|
|
|
|
| 59 |
|
| 60 |
def run_pythonanalysis():
|
| 61 |
+
return "Analysis already completed. See Dashboard tab for results."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
def run_full_pipeline():
|