Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,6 @@ transform = transforms.Compose([
|
|
| 32 |
])
|
| 33 |
|
| 34 |
|
| 35 |
-
# ββ Inference logic ββ
|
| 36 |
def classify(image, progress=gr.Progress(track_tqdm=True)):
|
| 37 |
try:
|
| 38 |
image = image.convert("RGB")
|
|
@@ -44,7 +43,10 @@ def classify(image, progress=gr.Progress(track_tqdm=True)):
|
|
| 44 |
|
| 45 |
return {CLASS_NAMES[prediction]: 1.0}
|
| 46 |
except Exception as e:
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
|
| 50 |
# ββ Gradio Layout ββ
|
|
|
|
| 32 |
])
|
| 33 |
|
| 34 |
|
|
|
|
| 35 |
def classify(image, progress=gr.Progress(track_tqdm=True)):
|
| 36 |
try:
|
| 37 |
image = image.convert("RGB")
|
|
|
|
| 43 |
|
| 44 |
return {CLASS_NAMES[prediction]: 1.0}
|
| 45 |
except Exception as e:
|
| 46 |
+
print("Error during prediction:", e)
|
| 47 |
+
# Return fixed label with zero confidence or default fallback
|
| 48 |
+
return {"Error": 0.0}
|
| 49 |
+
|
| 50 |
|
| 51 |
|
| 52 |
# ββ Gradio Layout ββ
|