Spaces:
Sleeping
Sleeping
Elliot Sones
commited on
Commit
·
f04b65a
1
Parent(s):
67fede5
Add startup diagnostics for debugging
Browse files
app.py
CHANGED
|
@@ -9,6 +9,29 @@ import numpy as np
|
|
| 9 |
import gradio as gr
|
| 10 |
import torch
|
| 11 |
from torch import nn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# ============================================================================
|
| 14 |
# Model Definition
|
|
|
|
| 9 |
import gradio as gr
|
| 10 |
import torch
|
| 11 |
from torch import nn
|
| 12 |
+
import os
|
| 13 |
+
|
| 14 |
+
# ============================================================================
|
| 15 |
+
# DIAGNOSTICS (Log to console for HF Spaces)
|
| 16 |
+
# ============================================================================
|
| 17 |
+
print("--- STARTING APP DIAGNOSTICS ---")
|
| 18 |
+
print(f"CWD: {os.getcwd()}")
|
| 19 |
+
print(f"Files in CWD: {os.listdir('.')}")
|
| 20 |
+
|
| 21 |
+
model_file = Path("rnn_animals_best.pt")
|
| 22 |
+
if model_file.exists():
|
| 23 |
+
size = model_file.stat().st_size
|
| 24 |
+
print(f"Model file found. Size: {size} bytes ({size/1024/1024:.2f} MB)")
|
| 25 |
+
if size < 2000:
|
| 26 |
+
print("WARNING: Model file is suspiciously small! Likely an LFS pointer file.")
|
| 27 |
+
try:
|
| 28 |
+
with open(model_file, 'r') as f:
|
| 29 |
+
print(f"Content preview: {f.read()}")
|
| 30 |
+
except:
|
| 31 |
+
pass
|
| 32 |
+
else:
|
| 33 |
+
print("ERROR: Model file 'rnn_animals_best.pt' NOT FOUND in CWD!")
|
| 34 |
+
print("--- END DIAGNOSTICS ---")
|
| 35 |
|
| 36 |
# ============================================================================
|
| 37 |
# Model Definition
|