DHEIVER commited on
Commit
021641e
1 Parent(s): 0f2ceae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -24,20 +24,14 @@ def classify_image(image):
24
  confidence = np.max(prediction[0])
25
 
26
  if confidence < 0.6:
27
- report = {
28
- 'result': "Unable to detect",
29
- 'confidence': confidence,
30
- 'details': "The model was unable to confidently classify the image."
31
- }
32
  else:
33
  class_name = class_names[predicted_class.numpy()]
34
- report = {
35
- 'result': class_name,
36
- 'confidence': confidence,
37
- 'details': f"The image is classified as {class_name} with a confidence of {confidence:.2f}."
38
- }
39
 
40
- return report
41
 
42
 
43
  iface = gr.Interface(
 
24
  confidence = np.max(prediction[0])
25
 
26
  if confidence < 0.6:
27
+ result = "Unable to detect"
28
+ details = "The model was unable to confidently classify the image."
 
 
 
29
  else:
30
  class_name = class_names[predicted_class.numpy()]
31
+ result = class_name
32
+ details = f"The image is classified as {class_name} with a confidence of {confidence:.2f}."
 
 
 
33
 
34
+ return result, confidence, details
35
 
36
 
37
  iface = gr.Interface(