Spaces:
Sleeping
Sleeping
Upload runtime.py
Browse files1131 unmodified lines11321133113411351136113735 unmodified lines11731174117511761177117828 unmodified lines12071208120912101211121212131214121576 unmodified lines12921293129412951296129717 unmodified lines1315131613171318131913201131 unmodified linesdaily: pd.DataFrame,t5_test: pd.DataFrame,tomorrow_test: pd.DataFrame,tplus1_test: pd.DataFrame,t5_latest: dict[str, Any],tomorrow_latest: dict[str, Any],35 unmodified linespred = "UP" if int(row.get("pred")) == 1 else "DOWN"add_prediction(row.get("target_date") or row.get("date"), pred, "Tomorrow", 20, {"prob_up": row.get("prob_up")})add_prediction(tomorrow_latest.get("target_date"), tomorrow_latest.get("prediction"), "Tomorrow", 40, {"prob_up": tomorrow_latest.get("prob_up")})records: list[dict[str, Any]] = []28 unmodified linestplus1_summary = load_tplus1_summary()tplus1_latest = latest_tplus1_prediction()refresh_state = load_refresh_state()t5_test = load_test_predictions()tomorrow_test = load_tomorrow_test_predictions()tplus1_test = load_tplus1_test_predictions()daily = pd.read_parquet(NIFTY_1D_PATH)daily["date"] = pd.to_datetime(daily["date"], errors="coerce")daily = daily.sort_values("date").tail(180)76 unmodified linesdaily,t5_test,tomorrow_test,tplus1_test,t5_latest,tomorrow_latest,17 unmodified lines"recent_predictions": _json_ready_frame(recent_predictions),"t5_recent_predictions": _json_ready_frame(recent_predictions),"tomorrow_recent_predictions": _json_ready_frame(tomorrow_recent),"tplus1_recent_predictions": _json_ready_frame(tplus1_test.tail(40)),"track_record": track_record,},1131 unmodified lines113211331134113511361137113835 unmodified lines1174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119628 unmodified lines122512261227122812291230123112321233123476 unmodified lines131113121313131413151316131717 unmodified lines13351336133713381339134013411131 unmodified linesdaily: pd.DataFrame,t5_test: pd.DataFrame,tomorrow_test: pd.DataFrame,tomorrow_history: pd.DataFrame,tplus1_test: pd.DataFrame,t5_latest: dict[str, Any],tomorrow_latest: dict[str, Any],35 unmodified linespred = "UP" if int(row.get("pred")) == 1 else "DOWN"add_prediction(row.get("target_date") or row.get("date"), pred, "Tomorrow", 20, {"prob_up": row.get("prob_up")})if not tomorrow_history.empty:for _, row in tomorrow_history.iterrows():pred = row.get("prediction")if pd.isna(pred) and "pred" in row:pred = "UP" if int(row.get("pred")) == 1 else "DOWN"target_date = row.get("target_date") or row.get("date") or row.get("input_date")add_prediction(target_date,pred,"Tomorrow",30,{"prob_up": row.get("prob_up"),"source": row.get("source"),},)add_prediction(tomorrow_latest.get("target_date"), tomorrow_latest.get("prediction"), "Tomorrow", 40, {"prob_up": tomorrow_latest.get("prob_up")})records: list[dict[str, Any]] = []28 unmodified linestplus1_summary = load_tplus1_summary()tplus1_latest = latest_tplus1_prediction()refresh_state = load_refresh_state()t5_test = load_test_predictions()tomorrow_test = load_tomorrow_test_predictions()tomorrow_history = _load_prediction_history(TOMORROW_PREDICTION_HISTORY_PATH)tplus1_test = load_tplus1_test_predictions()daily = pd.read_parquet(NIFTY_1D_PATH)daily["date"] = pd.to_datetime(daily["date"], errors="coerce")daily = daily.sort_values("date").tail(180)76 unmodified linesdaily,t5_test,tomorrow_test,tomorrow_history,tplus1_test,t5_latest,tomorrow_latest,17 unmodified lines"recent_predictions": _json_ready_frame(recent_predictions),"t5_recent_predictions": _json_ready_frame(recent_predictions),"tomorrow_recent_predictions": _json_ready_frame(tomorrow_recent),"tomorrow_history_predictions": _json_ready_frame(tomorrow_history.tail(80)),"tplus1_recent_predictions": _json_ready_frame(tplus1_test.tail(40)),"track_record": track_record,},
runtime.py+24-3