Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ st.markdown("<h4 style='text-align: center; color: #666;'>Áp dụng cho sinh vi
|
|
| 108 |
st.write("---")
|
| 109 |
|
| 110 |
# ===== SIDEBAR: chọn mô hình =====
|
| 111 |
-
model_type = st.sidebar.selectbox("🧠 Chọn mô hình dự báo:", ["Dùng toàn bộ
|
| 112 |
|
| 113 |
# ===== Giao diện nhập ví dụ =====
|
| 114 |
st.subheader("🔢 Chọn ví dụ mẫu hoặc nhập thông tin cá nhân")
|
|
@@ -231,7 +231,7 @@ data = []
|
|
| 231 |
semesters = ["HỌC KỲ I", "HỌC KỲ II", "HỌC KỲ III", "HỌC KỲ IV", "HỌC KỲ V", "HỌC KỲ VI"]
|
| 232 |
|
| 233 |
# Mô hình 1: "Dùng toàn bộ dữ liệu"
|
| 234 |
-
if model_type == "Dùng toàn bộ
|
| 235 |
st.subheader("🔢 Nhập thông tin học kỳ chi tiết")
|
| 236 |
for idx, sem in enumerate(semesters):
|
| 237 |
example_data = sample_cntt_example_full if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_full if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
|
|
@@ -245,7 +245,7 @@ else:
|
|
| 245 |
st.subheader("✨ Nhập thông tin rút gọn")
|
| 246 |
|
| 247 |
# Ensure the example defaults to "Không ví dụ" when model type is 2
|
| 248 |
-
if model_type == "Dùng
|
| 249 |
sample_option = "Không ví dụ" # Set the default example to "Không ví dụ"
|
| 250 |
|
| 251 |
# Allow selecting an example
|
|
@@ -257,7 +257,7 @@ else:
|
|
| 257 |
|
| 258 |
# ===== Predict =====
|
| 259 |
if st.button("🎯 DỰ BÁO"):
|
| 260 |
-
if model_type == "Dùng toàn bộ
|
| 261 |
prediction = model_full.predict(final_features)
|
| 262 |
sheet_name = "Trang tính1" # For full data model, save to Trang tính1
|
| 263 |
|
|
|
|
| 108 |
st.write("---")
|
| 109 |
|
| 110 |
# ===== SIDEBAR: chọn mô hình =====
|
| 111 |
+
model_type = st.sidebar.selectbox("🧠 Chọn mô hình dự báo:", ["Dùng toàn bộ đặc trưng", "Dùng đặc trưng quan trọng"])
|
| 112 |
|
| 113 |
# ===== Giao diện nhập ví dụ =====
|
| 114 |
st.subheader("🔢 Chọn ví dụ mẫu hoặc nhập thông tin cá nhân")
|
|
|
|
| 231 |
semesters = ["HỌC KỲ I", "HỌC KỲ II", "HỌC KỲ III", "HỌC KỲ IV", "HỌC KỲ V", "HỌC KỲ VI"]
|
| 232 |
|
| 233 |
# Mô hình 1: "Dùng toàn bộ dữ liệu"
|
| 234 |
+
if model_type == "Dùng toàn bộ đặc trưng":
|
| 235 |
st.subheader("🔢 Nhập thông tin học kỳ chi tiết")
|
| 236 |
for idx, sem in enumerate(semesters):
|
| 237 |
example_data = sample_cntt_example_full if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_full if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
|
|
|
|
| 245 |
st.subheader("✨ Nhập thông tin rút gọn")
|
| 246 |
|
| 247 |
# Ensure the example defaults to "Không ví dụ" when model type is 2
|
| 248 |
+
if model_type == "Dùng đặc trưng quan trọng":
|
| 249 |
sample_option = "Không ví dụ" # Set the default example to "Không ví dụ"
|
| 250 |
|
| 251 |
# Allow selecting an example
|
|
|
|
| 257 |
|
| 258 |
# ===== Predict =====
|
| 259 |
if st.button("🎯 DỰ BÁO"):
|
| 260 |
+
if model_type == "Dùng toàn bộ đặc trưng":
|
| 261 |
prediction = model_full.predict(final_features)
|
| 262 |
sheet_name = "Trang tính1" # For full data model, save to Trang tính1
|
| 263 |
|