DHEIVER commited on
Commit
0ad24c5
·
1 Parent(s): 5f0bbf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -2,6 +2,19 @@ import gradio as gr
2
  import tensorflow as tf
3
  import numpy as np
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Load your trained TensorFlow model
6
  model = tf.keras.models.load_model('modelo_treinado.h5') # Load your saved model
7
 
 
2
  import tensorflow as tf
3
  import numpy as np
4
 
5
+ # Define a custom layer for FixedDropout
6
+ class FixedDropout(tf.keras.layers.Dropout):
7
+ def _get_noise_shape(self, inputs):
8
+ if self.noise_shape is None:
9
+ return self.noise_shape
10
+ symbolic_shape = tf.shape(inputs)
11
+ noise_shape = [symbolic_shape[axis] if shape is None else shape
12
+ for axis, shape in enumerate(self.noise_shape)]
13
+ return tuple(noise_shape)
14
+
15
+ # Register the custom layer
16
+ tf.keras.utils.get_custom_objects()['FixedDropout'] = FixedDropout
17
+
18
  # Load your trained TensorFlow model
19
  model = tf.keras.models.load_model('modelo_treinado.h5') # Load your saved model
20