OmarEllethy commited on
Commit
4bbe7c5
1 Parent(s): d75a914

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import subprocess
2
- import joblib
3
  import numpy as np
4
  from PIL import Image
5
  import io
@@ -27,8 +27,12 @@ libraries = [
27
  for library in libraries:
28
  install_package(library)
29
 
30
- # Now that TensorFlow and other libraries are installed, import them
31
- import tensorflow as tf
 
 
 
 
32
 
33
  # Load the pre-trained TensorFlow model
34
  model = tf.keras.models.load_model("imageclassifier.h5")
 
1
  import subprocess
2
+ import tensorflow as tf
3
  import numpy as np
4
  from PIL import Image
5
  import io
 
27
  for library in libraries:
28
  install_package(library)
29
 
30
+ # Attempt to import required libraries after installation
31
+ try:
32
+ import joblib
33
+ except ImportError:
34
+ print("Error: joblib failed to install or import.")
35
+ exit(1)
36
 
37
  # Load the pre-trained TensorFlow model
38
  model = tf.keras.models.load_model("imageclassifier.h5")