koesan commited on
Commit
d07eded
·
verified ·
1 Parent(s): 0a192a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -18,17 +18,20 @@ 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.1.0 (February 2020 version)
22
- print("Loading model with TensorFlow 2.1.0 (Feb 2020)...")
23
  import warnings
24
  warnings.filterwarnings('ignore')
25
 
26
  try:
27
- # Load model as it was saved in Feb 2020
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
  import traceback
33
  traceback.print_exc()
34
  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.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