rezaenayati commited on
Commit
961a3be
·
verified ·
1 Parent(s): 7582b30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -29,7 +29,11 @@ def predict(input_dict):
29
  # Predict
30
  prediction = model.predict(image)
31
  probs = tf.nn.softmax(prediction[0]).numpy()
32
- return {str(i): float(probs[i]) for i in range(10)}
 
 
 
 
33
 
34
  # Create the Gradio interface with appropriate settings
35
  sketchpad = gr.Sketchpad() # <- clean and version-safe
 
29
  # Predict
30
  prediction = model.predict(image)
31
  probs = tf.nn.softmax(prediction[0]).numpy()
32
+
33
+ if probs[0] < 50.0:
34
+ return "Please try again."
35
+ else:
36
+ return {str(i): float(probs[i]) for i in range(10)}
37
 
38
  # Create the Gradio interface with appropriate settings
39
  sketchpad = gr.Sketchpad() # <- clean and version-safe