Spaces:
Runtime error
Runtime error
Commit
•
ada111e
1
Parent(s):
bf8fdc4
Update app.py
Browse files
app.py
CHANGED
@@ -23,21 +23,18 @@ def predict_image(image):
|
|
23 |
image = tf.keras.preprocessing.image.img_to_array(image)
|
24 |
image = np.expand_dims(image, axis=0)
|
25 |
|
26 |
-
|
27 |
prediction = model.predict(image)
|
28 |
|
29 |
-
# Get the probability of being '
|
30 |
-
|
31 |
-
predicted_class_index = np.argmax(probabilities)
|
32 |
-
if predicted_class_index == 0:
|
33 |
-
predicted_label = "Clean"
|
34 |
-
predicted_probability = probabilities[0][0] * 100 # Convert to percentage
|
35 |
-
else:
|
36 |
-
predicted_label = "Carries"
|
37 |
-
predicted_probability = probabilities[0][1] * 100 # Convert to percentage
|
38 |
|
39 |
-
#
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
# Create the interface
|
@@ -48,7 +45,7 @@ iface = gr.Interface(
|
|
48 |
fn=predict_image,
|
49 |
inputs=input_interface,
|
50 |
outputs=output_interface,
|
51 |
-
title="<h1 style='color: lightgreen; text-align: center;'>Dentella</h1><p style='text-align:
|
52 |
|
53 |
|
54 |
# Launch the interface
|
|
|
23 |
image = tf.keras.preprocessing.image.img_to_array(image)
|
24 |
image = np.expand_dims(image, axis=0)
|
25 |
|
26 |
+
# Make a prediction
|
27 |
prediction = model.predict(image)
|
28 |
|
29 |
+
# Get the probability of being 'Good'
|
30 |
+
probability_good = prediction[0][0] # Assuming it's a binary classification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
# Define the prediction result
|
33 |
+
result = {
|
34 |
+
"prediction": "Your Teeth are Good & You Don't Need To Visit Doctor" if probability_good > 0.5 else "Your Teeth are Bad & You Need To Visit Doctor"
|
35 |
+
}
|
36 |
+
|
37 |
+
return result
|
38 |
|
39 |
|
40 |
# Create the interface
|
|
|
45 |
fn=predict_image,
|
46 |
inputs=input_interface,
|
47 |
outputs=output_interface,
|
48 |
+
title="<h1 style='color: lightgreen; text-align: center;'>Dentella</h1><p style='text-align: left; color: skyblue; font-size: 25px;'>Please Enter Your Teeth Here...</p>",)
|
49 |
|
50 |
|
51 |
# Launch the interface
|