COCODEDE04 commited on
Commit
1b75554
·
verified ·
1 Parent(s): 340d80c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -917,4 +917,29 @@ def debug_db_head(n: int = 5):
917
  "rows": int(len(df)),
918
  "head": df.head(n).to_dict(orient="records"),
919
  "columns": list(df.columns),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
920
  }
 
917
  "rows": int(len(df)),
918
  "head": df.head(n).to_dict(orient="records"),
919
  "columns": list(df.columns),
920
+ }
921
+
922
+ import pandas as pd # make sure this is at the top of the file if not already
923
+ # from here: after append_and_retrain
924
+
925
+ @app.get("/debug/db_tail")
926
+ def debug_db_tail(n: int = 10):
927
+ """
928
+ Returns the last n rows of fingerprints_db.csv so you can verify
929
+ that new points are really being appended inside the container.
930
+ """
931
+ if not os.path.exists(FINGERPRINT_CSV):
932
+ return {"ok": False, "error": f"{FINGERPRINT_CSV} not found"}
933
+
934
+ try:
935
+ df = pd.read_csv(FINGERPRINT_CSV)
936
+ except Exception as e:
937
+ return {"ok": False, "error": f"Failed to read CSV: {e}"}
938
+
939
+ tail = df.tail(n)
940
+ return {
941
+ "ok": True,
942
+ "rows": tail.to_dict(orient="records"),
943
+ "n_rows_total": int(df.shape[0]),
944
+ "n_returned": int(tail.shape[0]),
945
  }