elhamb commited on
Commit
1c355f3
·
verified ·
1 Parent(s): 46d1861

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -47,17 +47,13 @@ def predict_image(input_img_pil):
47
 
48
  # 3. Prediction
49
  print(f"Array shape for model input: {img_array.shape}")
50
- predictions = model.predict(img_array)[0] # Get the single prediction result
51
  print(f"Raw model predictions: {predictions}")
52
 
53
  # 4. Format the output for Gradio's Label component
54
  # Assuming predictions is a 2-element array: [prob_cat, prob_dog]
55
- output_dict = {
56
- CLASS_LABELS[0]: float(predictions[0]),
57
- CLASS_LABELS[1]: float(predictions[1])
58
- }
59
 
60
- return output_dict
61
 
62
  except Exception as e:
63
  # Catch any error, log it, and return it to the user in a visible format
 
47
 
48
  # 3. Prediction
49
  print(f"Array shape for model input: {img_array.shape}")
50
+ predictions = model.predict(img_array) # Get the single prediction result
51
  print(f"Raw model predictions: {predictions}")
52
 
53
  # 4. Format the output for Gradio's Label component
54
  # Assuming predictions is a 2-element array: [prob_cat, prob_dog]
 
 
 
 
55
 
56
+ return predictions
57
 
58
  except Exception as e:
59
  # Catch any error, log it, and return it to the user in a visible format