Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,14 +4,14 @@ import requests
|
|
4 |
import cv2
|
5 |
import numpy as np
|
6 |
|
7 |
-
# Define a custom layer 'FixedDropout'
|
8 |
def fixed_dropout(x):
|
9 |
return tf.keras.layers.Dropout(0.5)(x)
|
10 |
|
11 |
# Load the TensorFlow model while registering the custom layer
|
12 |
-
|
13 |
tf_model_path = 'modelo_treinado.h5' # Update with the path to your TensorFlow model
|
14 |
-
tf_model = tf.keras.models.load_model(tf_model_path)
|
15 |
|
16 |
class_labels = ["Normal", "Cataract"]
|
17 |
|
@@ -31,8 +31,7 @@ def predict(inp):
|
|
31 |
demo = gr.Interface(
|
32 |
fn=predict,
|
33 |
inputs=gr.inputs.Image(type="pil"),
|
34 |
-
outputs=["label", "number"]
|
35 |
-
examples=[["cheetah.jpg"]],
|
36 |
)
|
37 |
|
38 |
demo.launch()
|
|
|
4 |
import cv2
|
5 |
import numpy as np
|
6 |
|
7 |
+
# Define a custom layer 'FixedDropout' without specifying 'name' argument
|
8 |
def fixed_dropout(x):
|
9 |
return tf.keras.layers.Dropout(0.5)(x)
|
10 |
|
11 |
# Load the TensorFlow model while registering the custom layer
|
12 |
+
custom_objects = {'fixed_dropout': fixed_dropout}
|
13 |
tf_model_path = 'modelo_treinado.h5' # Update with the path to your TensorFlow model
|
14 |
+
tf_model = tf.keras.models.load_model(tf_model_path, custom_objects=custom_objects)
|
15 |
|
16 |
class_labels = ["Normal", "Cataract"]
|
17 |
|
|
|
31 |
demo = gr.Interface(
|
32 |
fn=predict,
|
33 |
inputs=gr.inputs.Image(type="pil"),
|
34 |
+
outputs=["label", "number"]
|
|
|
35 |
)
|
36 |
|
37 |
demo.launch()
|