Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from PIL import Image
|
|
| 4 |
|
| 5 |
# Load the model and processor
|
| 6 |
model_name = "quadranttechnologies/retail-content-safety-clip-finetuned"
|
| 7 |
-
print("
|
| 8 |
|
| 9 |
try:
|
| 10 |
model = CLIPModel.from_pretrained(model_name, trust_remote_code=True)
|
|
@@ -12,7 +12,7 @@ try:
|
|
| 12 |
print("Model and processor loaded successfully.")
|
| 13 |
except Exception as e:
|
| 14 |
print(f"Error loading the model or processor: {e}")
|
| 15 |
-
raise
|
| 16 |
|
| 17 |
# Define the inference function
|
| 18 |
def classify_image(image):
|
|
@@ -92,5 +92,6 @@ if __name__ == "__main__":
|
|
| 92 |
|
| 93 |
|
| 94 |
|
|
|
|
| 95 |
|
| 96 |
|
|
|
|
| 4 |
|
| 5 |
# Load the model and processor
|
| 6 |
model_name = "quadranttechnologies/retail-content-safety-clip-finetuned"
|
| 7 |
+
print("Loading the model and processor...")
|
| 8 |
|
| 9 |
try:
|
| 10 |
model = CLIPModel.from_pretrained(model_name, trust_remote_code=True)
|
|
|
|
| 12 |
print("Model and processor loaded successfully.")
|
| 13 |
except Exception as e:
|
| 14 |
print(f"Error loading the model or processor: {e}")
|
| 15 |
+
raise RuntimeError(f"Failed to load model: {e}")
|
| 16 |
|
| 17 |
# Define the inference function
|
| 18 |
def classify_image(image):
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
+
|
| 96 |
|
| 97 |
|