Update app.py
Browse files
app.py
CHANGED
|
@@ -42,11 +42,11 @@ def load_model_from_huggingface(repo_id="tfarhan10/Clothing1M-Pretrained-ResNet5
|
|
| 42 |
model.load_state_dict(new_state_dict, strict=False) # `strict=False` allows minor mismatches
|
| 43 |
model.eval() # Set model to evaluation mode
|
| 44 |
|
| 45 |
-
print("
|
| 46 |
return model
|
| 47 |
|
| 48 |
except Exception as e:
|
| 49 |
-
print(f"
|
| 50 |
return None
|
| 51 |
|
| 52 |
# Load the model
|
|
@@ -94,10 +94,10 @@ def load_example_image():
|
|
| 94 |
if response.status_code == 200:
|
| 95 |
return Image.open(BytesIO(response.content)).convert("RGB")
|
| 96 |
else:
|
| 97 |
-
print("
|
| 98 |
return None
|
| 99 |
except Exception as e:
|
| 100 |
-
print(f"
|
| 101 |
return None
|
| 102 |
|
| 103 |
# Example image
|
|
|
|
| 42 |
model.load_state_dict(new_state_dict, strict=False) # `strict=False` allows minor mismatches
|
| 43 |
model.eval() # Set model to evaluation mode
|
| 44 |
|
| 45 |
+
print("Model loaded successfully from Hugging Face!")
|
| 46 |
return model
|
| 47 |
|
| 48 |
except Exception as e:
|
| 49 |
+
print(f"Error loading model: {e}")
|
| 50 |
return None
|
| 51 |
|
| 52 |
# Load the model
|
|
|
|
| 94 |
if response.status_code == 200:
|
| 95 |
return Image.open(BytesIO(response.content)).convert("RGB")
|
| 96 |
else:
|
| 97 |
+
print("Failed to fetch example image.")
|
| 98 |
return None
|
| 99 |
except Exception as e:
|
| 100 |
+
print(f"Error loading example image: {e}")
|
| 101 |
return None
|
| 102 |
|
| 103 |
# Example image
|