har1zarD commited on
Commit
aafd758
·
1 Parent(s): c6bdf63
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +3 -3
app.py CHANGED
@@ -431,10 +431,11 @@ class FoodRecognizer:
431
  **load_kwargs
432
  )
433
 
434
- # Učitaj model
435
  self.model = AutoModelForImageClassification.from_pretrained(
436
  model_name,
437
  torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
 
438
  **load_kwargs
439
  )
440
 
@@ -461,6 +462,7 @@ class FoodRecognizer:
461
  )
462
  self.model = AutoModelForImageClassification.from_pretrained(
463
  model_name,
 
464
  **load_kwargs
465
  )
466
  self.model = self.model.to(self.device)
 
431
  **load_kwargs
432
  )
433
 
434
+ # Učitaj model (force safetensors for security)
435
  self.model = AutoModelForImageClassification.from_pretrained(
436
  model_name,
437
  torch_dtype=torch.float16 if self.device == "cuda" else torch.float32,
438
+ use_safetensors=True, # Force safetensors format (security)
439
  **load_kwargs
440
  )
441
 
 
462
  )
463
  self.model = AutoModelForImageClassification.from_pretrained(
464
  model_name,
465
+ use_safetensors=True, # Force safetensors format (security)
466
  **load_kwargs
467
  )
468
  self.model = self.model.to(self.device)
requirements.txt CHANGED
@@ -4,9 +4,9 @@
4
  # ==================== Core Dependencies ====================
5
  # Python 3.9+ required
6
 
7
- # Deep Learning Framework
8
- torch>=2.0.0,<2.3.0
9
- torchvision>=0.15.0
10
 
11
  # Hugging Face Transformers (for pretrained models)
12
  transformers>=4.35.0
 
4
  # ==================== Core Dependencies ====================
5
  # Python 3.9+ required
6
 
7
+ # Deep Learning Framework (upgraded for security CVE-2025-32434)
8
+ torch>=2.6.0
9
+ torchvision>=0.20.0
10
 
11
  # Hugging Face Transformers (for pretrained models)
12
  transformers>=4.35.0