SHXn3 commited on
Commit
fe39adc
Β·
verified Β·
1 Parent(s): d85998c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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
- return {"Error": str(e)}
 
 
 
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 ──