ZELEFACK commited on
Commit
d36ead2
·
verified ·
1 Parent(s): eb6f85b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -7,6 +7,20 @@ from tensorflow.keras.layers.experimental.preprocessing import RandomHeight
7
  with CustomObjectScope({'RandomHeight': RandomHeight}):
8
  model_0 = tf.keras.models.load_model('bestmodel.h5')
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  def classify_image(inp):
11
  # Convert to PIL Image if we have a numpy array
12
  image = None
 
7
  with CustomObjectScope({'RandomHeight': RandomHeight}):
8
  model_0 = tf.keras.models.load_model('bestmodel.h5')
9
 
10
+
11
+ print("TensorFlow version:", tf.__version__)
12
+ print("GPU Available:", tf.config.list_physical_devices('GPU'))
13
+
14
+ # Configure TensorFlow to use memory growth
15
+ gpus = tf.config.experimental.list_physical_devices('GPU')
16
+ if gpus:
17
+ try:
18
+ for gpu in gpus:
19
+ tf.config.experimental.set_memory_growth(gpu, True)
20
+ except RuntimeError as e:
21
+ print(e)
22
+
23
+
24
  def classify_image(inp):
25
  # Convert to PIL Image if we have a numpy array
26
  image = None