Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import numpy as np
|
|
4 |
from PIL import Image
|
5 |
import cv2
|
6 |
import datetime
|
|
|
7 |
|
8 |
# Define the custom FixedDropout layer
|
9 |
class FixedDropout(tf.keras.layers.Layer):
|
@@ -16,6 +17,9 @@ class FixedDropout(tf.keras.layers.Layer):
|
|
16 |
training = K.learning_phase()
|
17 |
return K.in_train_phase(K.dropout(inputs, self.rate), inputs, training=training)
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
class ImageClassifierApp:
|
21 |
def __init__(self, model_path):
|
@@ -68,6 +72,6 @@ class ImageClassifierApp:
|
|
68 |
input_interface.launch()
|
69 |
|
70 |
if __name__ == "__main__":
|
71 |
-
model_path = 'modelo_treinado.h5' #
|
72 |
app = ImageClassifierApp(model_path)
|
73 |
app.run_interface()
|
|
|
4 |
from PIL import Image
|
5 |
import cv2
|
6 |
import datetime
|
7 |
+
from tensorflow.keras import backend as K
|
8 |
|
9 |
# Define the custom FixedDropout layer
|
10 |
class FixedDropout(tf.keras.layers.Layer):
|
|
|
17 |
training = K.learning_phase()
|
18 |
return K.in_train_phase(K.dropout(inputs, self.rate), inputs, training=training)
|
19 |
|
20 |
+
def get_config(self):
|
21 |
+
config = super(FixedDropout, self).get_config()
|
22 |
+
return config
|
23 |
|
24 |
class ImageClassifierApp:
|
25 |
def __init__(self, model_path):
|
|
|
72 |
input_interface.launch()
|
73 |
|
74 |
if __name__ == "__main__":
|
75 |
+
model_path = 'modelo_treinado.h5' # Replace with the path to your trained model
|
76 |
app = ImageClassifierApp(model_path)
|
77 |
app.run_interface()
|