Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,17 @@ from PIL import Image
|
|
| 5 |
import cv2
|
| 6 |
import datetime
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
class ImageClassifierApp:
|
| 9 |
def __init__(self, model_path):
|
| 10 |
self.model_path = model_path
|
|
@@ -55,7 +66,6 @@ class ImageClassifierApp:
|
|
| 55 |
)
|
| 56 |
input_interface.launch()
|
| 57 |
|
| 58 |
-
|
| 59 |
if __name__ == "__main__":
|
| 60 |
model_path = 'modelo_treinado.h5' # Substitua pelo caminho para o seu modelo treinado
|
| 61 |
app = ImageClassifierApp(model_path)
|
|
|
|
| 5 |
import cv2
|
| 6 |
import datetime
|
| 7 |
|
| 8 |
+
# Define the custom FixedDropout layer
|
| 9 |
+
class FixedDropout(tf.keras.layers.Layer):
|
| 10 |
+
def __init__(self, rate, **kwargs):
|
| 11 |
+
super(FixedDropout, self).__init__(**kwargs)
|
| 12 |
+
self.rate = rate
|
| 13 |
+
|
| 14 |
+
def call(self, inputs, training=None):
|
| 15 |
+
if training is None:
|
| 16 |
+
training = K.learning_phase()
|
| 17 |
+
return K.in_train_phase(K.dropout(inputs, self.rate), inputs, training=training)
|
| 18 |
+
|
| 19 |
class ImageClassifierApp:
|
| 20 |
def __init__(self, model_path):
|
| 21 |
self.model_path = model_path
|
|
|
|
| 66 |
)
|
| 67 |
input_interface.launch()
|
| 68 |
|
|
|
|
| 69 |
if __name__ == "__main__":
|
| 70 |
model_path = 'modelo_treinado.h5' # Substitua pelo caminho para o seu modelo treinado
|
| 71 |
app = ImageClassifierApp(model_path)
|