koesan commited on
Commit
a786b7a
·
verified ·
1 Parent(s): f15b093

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -18,20 +18,17 @@ app.config['UPLOAD_FOLDER'] = 'uploads'
18
  # Create uploads folder if it doesn't exist
19
  os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
20
 
21
- # Load the model with TensorFlow 2.11 (supports Functional class)
22
- print("Loading model with TensorFlow 2.11...")
23
  import warnings
24
  warnings.filterwarnings('ignore')
25
 
26
  try:
27
- # Load model with Functional class support
28
  model = load_model('cancer_model.h5', compile=False)
29
- print("✓ Model loaded successfully!")
30
  except Exception as e:
31
  print(f"❌ Error loading model: {e}")
32
- print("\n⚠️ MODEL FILE IS INCOMPATIBLE")
33
- print("Your model file contains both old and new TensorFlow features.")
34
- print("Please re-save your model in your training environment.")
35
  import traceback
36
  traceback.print_exc()
37
  raise
 
18
  # Create uploads folder if it doesn't exist
19
  os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
20
 
21
+ # Load the model with TensorFlow 2.16 (Keras 3)
22
+ print("Loading model with TensorFlow 2.16 (Keras 3)...")
23
  import warnings
24
  warnings.filterwarnings('ignore')
25
 
26
  try:
27
+ # TensorFlow 2.16+ uses Keras 3 which handles the model format
28
  model = load_model('cancer_model.h5', compile=False)
29
+ print("✓ Model loaded successfully with Keras 3!")
30
  except Exception as e:
31
  print(f"❌ Error loading model: {e}")
 
 
 
32
  import traceback
33
  traceback.print_exc()
34
  raise