Spaces:
Configuration error
Configuration error
Download scripts/inspect_db.py from Shaikhsarib/EatlyticApp: direct link, hf CLI and curl.
- Browser
- Download file 752 Bytes
-
https://huggingface.co/spaces/Shaikhsarib/EatlyticApp/resolve/main/scripts/inspect_db.py
- Command line
-
hf download hf://spaces/Shaikhsarib/EatlyticApp/scripts/inspect_db.py
-
curl -L -o inspect_db.py https://huggingface.co/spaces/Shaikhsarib/EatlyticApp/resolve/main/scripts/inspect_db.py
752 Bytes
| import sqlite3 | |
| import json | |
| def inspect(): | |
| conn = sqlite3.connect('data/eatlytic.db') | |
| conn.row_factory = sqlite3.Row | |
| try: | |
| row = conn.execute("SELECT * FROM scans ORDER BY id DESC LIMIT 1").fetchone() | |
| if row: | |
| print(f"ID: {row['id']}") | |
| print(f"Product: {row['product_name']}") | |
| print(f"Calories: {row['calories']}") | |
| print(f"Protein: {row['protein']}") | |
| print(f"Fat: {row['fat']}") | |
| print(f"Carbs: {row['carbs']}") | |
| print(f"Analysis JSON: {row['analysis_json']}") | |
| else: | |
| print("No scans found.") | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| finally: | |
| conn.close() | |
| if __name__ == '__main__': | |
| inspect() | |