Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
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
|