Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -896,4 +896,25 @@ def append_and_retrain(payload: dict):
|
|
| 896 |
# Retrain model on full updated DB
|
| 897 |
retrain_model()
|
| 898 |
|
| 899 |
-
return {"ok": True, "message": "Fingerprint appended and model retrained"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 896 |
# Retrain model on full updated DB
|
| 897 |
retrain_model()
|
| 898 |
|
| 899 |
+
return {"ok": True, "message": "Fingerprint appended and model retrained"}
|
| 900 |
+
|
| 901 |
+
|
| 902 |
+
@app.get("/debug/db_head")
|
| 903 |
+
def debug_db_head(n: int = 5):
|
| 904 |
+
import os
|
| 905 |
+
import pandas as pd
|
| 906 |
+
|
| 907 |
+
if not os.path.exists(FINGERPRINT_CSV):
|
| 908 |
+
return {
|
| 909 |
+
"exists": False,
|
| 910 |
+
"message": f"{FINGERPRINT_CSV} not found in current working dir."
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
df = pd.read_csv(FINGERPRINT_CSV)
|
| 914 |
+
return {
|
| 915 |
+
"exists": True,
|
| 916 |
+
"file": FINGERPRINT_CSV,
|
| 917 |
+
"rows": int(len(df)),
|
| 918 |
+
"head": df.head(n).to_dict(orient="records"),
|
| 919 |
+
"columns": list(df.columns),
|
| 920 |
+
}
|