glaucomasi commited on
Commit
d46dab2
·
1 Parent(s): 0bae4a1
Files changed (1) hide show
  1. app.py +2 -25
app.py CHANGED
@@ -18,33 +18,10 @@ FILENAME = "effnetb2_food101_20percent_3classes.safetensors"
18
  weights_path = hf_hub_download(
19
  repo_id=MODEL_REPO,
20
  filename=FILENAME,
21
- local_dir=".", # optional: place a real copy into your app folder
22
- local_dir_use_symlinks=False, # real file instead of symlink (handy for debug)
23
  )
24
 
25
-
26
-
27
- print("== Debug: file existence ==")
28
- print("Exists?", os.path.exists(weights_path))
29
- if os.path.exists(weights_path):
30
- print("File size (bytes):", os.path.getsize(weights_path))
31
- # Peek first bytes
32
- with open(weights_path, "rb") as f:
33
- head = f.read(200)
34
- print("First 200 bytes:", head[:200])
35
- else:
36
- print("File not found at:", weights_path)
37
-
38
- # Try safetensors open
39
- try:
40
- with safe_open(weights_path, framework="pt") as f:
41
- keys = list(f.keys())
42
- print("== Debug: safetensors keys sample ==")
43
- print(keys[:10])
44
- except Exception as e:
45
- print("== Debug: safetensors load error ==")
46
- print(repr(e))
47
-
48
  sd = load_file(weights_path)
49
  effnetb2.load_state_dict(sd, strict=True)
50
  effnetb2.eval()
 
18
  weights_path = hf_hub_download(
19
  repo_id=MODEL_REPO,
20
  filename=FILENAME,
21
+ local_dir=".",
22
+ local_dir_use_symlinks=False,
23
  )
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  sd = load_file(weights_path)
26
  effnetb2.load_state_dict(sd, strict=True)
27
  effnetb2.eval()