rishab1090 commited on
Commit
015bf69
·
verified ·
1 Parent(s): 789f763

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -9,18 +9,16 @@ app = FastAPI()
9
 
10
  # Load your model
11
  import os
12
- import tensorflow as tf
13
 
14
  model_path = "models/2.keras"
15
 
16
- # Just check if file is accessible
17
- if os.path.exists(model_path):
18
- model = tf.keras.models.load_model(model_path)
19
- else:
20
- raise FileNotFoundError("Model not found at: models/2.keras")
21
 
22
  # Now load the model
23
- model = tf.keras.models.load_model(model_path)
24
 
25
  CLASS_NAMES = ['Fungi', 'Healthy', 'Nematode', 'Pest', 'Phytopthora', 'Virus']
26
 
 
9
 
10
  # Load your model
11
  import os
12
+
13
 
14
  model_path = "models/2.keras"
15
 
16
+ with tf.io.gfile.GFile(model_path, 'rb') as f:
17
+ model = tf.keras.models.load_model(f)
18
+
 
 
19
 
20
  # Now load the model
21
+
22
 
23
  CLASS_NAMES = ['Fungi', 'Healthy', 'Nematode', 'Pest', 'Phytopthora', 'Virus']
24