Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import gradio as gr
|
|
| 4 |
import tensorflow as tf
|
| 5 |
from PIL import Image
|
| 6 |
from tensorflow.keras.models import load_model
|
|
|
|
| 7 |
# Load the model
|
| 8 |
model_path = 'final_teath_classifier.h5'
|
| 9 |
model = tf.keras.models.load_model(model_path)
|
|
@@ -31,16 +32,16 @@ def predict_image(image):
|
|
| 31 |
predict_label = "Carries"
|
| 32 |
confidence = float(np.max(predictions))
|
| 33 |
prediction_dict = {"prediction": predict_label, "confidence": confidence}
|
| 34 |
-
return
|
| 35 |
|
| 36 |
# Create the interface
|
| 37 |
-
input_interface = gr.Image()
|
| 38 |
-
output_interface =
|
| 39 |
|
| 40 |
iface = gr.Interface(
|
| 41 |
fn=predict_image,
|
| 42 |
inputs=input_interface,
|
| 43 |
-
outputs=
|
| 44 |
|
| 45 |
# Launch the interface
|
| 46 |
iface.launch(share=True)
|
|
|
|
| 4 |
import tensorflow as tf
|
| 5 |
from PIL import Image
|
| 6 |
from tensorflow.keras.models import load_model
|
| 7 |
+
|
| 8 |
# Load the model
|
| 9 |
model_path = 'final_teath_classifier.h5'
|
| 10 |
model = tf.keras.models.load_model(model_path)
|
|
|
|
| 32 |
predict_label = "Carries"
|
| 33 |
confidence = float(np.max(predictions))
|
| 34 |
prediction_dict = {"prediction": predict_label, "confidence": confidence}
|
| 35 |
+
return prediction_dict
|
| 36 |
|
| 37 |
# Create the interface
|
| 38 |
+
input_interface = gr.inputs.Image()
|
| 39 |
+
output_interface = gr.outputs.JSON()
|
| 40 |
|
| 41 |
iface = gr.Interface(
|
| 42 |
fn=predict_image,
|
| 43 |
inputs=input_interface,
|
| 44 |
+
outputs=output_interface)
|
| 45 |
|
| 46 |
# Launch the interface
|
| 47 |
iface.launch(share=True)
|