Chanlefe commited on
Commit
23ad95f
·
verified ·
1 Parent(s): 6a6e076

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -73,8 +73,25 @@ try:
73
  print("Model loaded successfully!")
74
 
75
  print("Loading processor...")
76
- processor = AutoProcessor.from_pretrained(MODEL_PATH, local_files_only=True)
77
- print("Processor loaded successfully!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  # Get labels - handle case where id2label might not exist
80
  if hasattr(model.config, 'id2label') and model.config.id2label:
 
73
  print("Model loaded successfully!")
74
 
75
  print("Loading processor...")
76
+ try:
77
+ processor = AutoProcessor.from_pretrained(MODEL_PATH, local_files_only=True)
78
+ print("Processor loaded successfully!")
79
+ except Exception as proc_error:
80
+ print(f"Error loading processor from local files: {proc_error}")
81
+ print("Attempting to load processor from base SigLIP model...")
82
+
83
+ # Try to load processor from the base SigLIP model
84
+ try:
85
+ processor = AutoProcessor.from_pretrained("google/siglip-base-patch16-224")
86
+ print("Processor loaded from base SigLIP model!")
87
+ except Exception as base_error:
88
+ print(f"Error loading base processor: {base_error}")
89
+ print("Trying alternative processor...")
90
+
91
+ # As a last resort, try to create a minimal processor
92
+ from transformers import CLIPImageProcessor
93
+ processor = CLIPImageProcessor.from_pretrained("openai/clip-vit-base-patch32")
94
+ print("Using CLIP processor as fallback!")
95
 
96
  # Get labels - handle case where id2label might not exist
97
  if hasattr(model.config, 'id2label') and model.config.id2label: