DHEIVER commited on
Commit
35cf55e
·
1 Parent(s): 8d504fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -4,7 +4,12 @@ import requests
4
  import cv2
5
  import numpy as np
6
 
7
- # Load the TensorFlow model
 
 
 
 
 
8
  tf_model_path = 'modelo_treinado.h5' # Update with the path to your TensorFlow model
9
  tf_model = tf.keras.models.load_model(tf_model_path)
10
 
@@ -26,7 +31,8 @@ def predict(inp):
26
  demo = gr.Interface(
27
  fn=predict,
28
  inputs=gr.inputs.Image(type="pil"),
29
- outputs=["label", "number"]
 
30
  )
31
 
32
  demo.launch()
 
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
+ tf.keras.utils.get_custom_objects()['FixedDropout'] = 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)
15
 
 
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()