tricc commited on
Commit
2ae681e
·
verified ·
1 Parent(s): 39c4bb3

update model loading os logic

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -4,6 +4,7 @@ import numpy as np
4
  import matplotlib.pyplot as plt
5
  import seaborn as sns
6
  import joblib
 
7
 
8
  plt.style.use('seaborn-v0_8-muted')
9
  sns.set_theme(style="whitegrid")
@@ -12,11 +13,18 @@ import warnings
12
  warnings.filterwarnings('ignore')
13
 
14
  # Load mô hình
 
 
 
 
15
  try:
16
- models = joblib.load('dental_models_v1.pkl')
17
- print("✅ Load model thành công.")
18
- except:
19
- print("⚠️ Lỗi: Không tìm thấy file model.")
 
 
 
20
 
21
  def preprocess_input(tuoi, gioi_tinh, ben_pt, kinh_nghiem,
22
  r7, canh_dung, goc, chan_rang, ord_lq,
 
4
  import matplotlib.pyplot as plt
5
  import seaborn as sns
6
  import joblib
7
+ import os
8
 
9
  plt.style.use('seaborn-v0_8-muted')
10
  sns.set_theme(style="whitegrid")
 
13
  warnings.filterwarnings('ignore')
14
 
15
  # Load mô hình
16
+ model_path = "dental_models_v1.pkl"
17
+
18
+ print(f"📂 Đang kiểm tra file tại: {os.getcwd()}/{model_path}")
19
+
20
  try:
21
+ if os.path.exists(model_path):
22
+ models = joblib.load(model_path)
23
+ print("✅ Load model thành công.")
24
+ else:
25
+ print("⚠️ Lỗi: Không tìm thấy file model.")
26
+ except Exception as e:
27
+ print(f"❌ Lỗi khi load model: {e}")
28
 
29
  def preprocess_input(tuoi, gioi_tinh, ben_pt, kinh_nghiem,
30
  r7, canh_dung, goc, chan_rang, ord_lq,