Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -242,15 +242,25 @@ if model_type == "Dùng toàn bộ đặc trưng":
|
|
| 242 |
|
| 243 |
# Mô hình 2: "Dùng mô hình đơn giản"
|
| 244 |
else:
|
| 245 |
-
|
| 246 |
-
# Ensure the example defaults to "Không ví dụ" when model type is 2
|
| 247 |
-
|
| 248 |
st.subheader("✨ Nhập thông tin rút gọn")
|
|
|
|
| 249 |
# Allow selecting an example
|
| 250 |
for idx, sem in enumerate(semesters):
|
| 251 |
example_data = sample_cntt_example_simple if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_simple if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
|
| 252 |
default_values = example_data["semester_data"][idx*3:(idx+1)*3] if example_data else None # Fix this line to slice 3 values per semester (Số tín chỉ đạt, Số tín chỉ nợ, GPA)
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
final_features = np.array(data).reshape(1, -1)
|
| 255 |
|
| 256 |
# ===== Predict =====
|
|
|
|
| 242 |
|
| 243 |
# Mô hình 2: "Dùng mô hình đơn giản"
|
| 244 |
else:
|
|
|
|
|
|
|
|
|
|
| 245 |
st.subheader("✨ Nhập thông tin rút gọn")
|
| 246 |
+
|
| 247 |
# Allow selecting an example
|
| 248 |
for idx, sem in enumerate(semesters):
|
| 249 |
example_data = sample_cntt_example_simple if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_simple if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
|
| 250 |
default_values = example_data["semester_data"][idx*3:(idx+1)*3] if example_data else None # Fix this line to slice 3 values per semester (Số tín chỉ đạt, Số tín chỉ nợ, GPA)
|
| 251 |
+
|
| 252 |
+
# Use expander to group each semester's fields in a collapsible box
|
| 253 |
+
with st.expander(f"📘 {sem}", expanded=True):
|
| 254 |
+
col1, col2 = st.columns(2)
|
| 255 |
+
with col1:
|
| 256 |
+
sotc_qua = st.number_input(f"Số tín chỉ đạt - {sem}", 0, value=default_values[0] if default_values else 0, key=f"tcqua_imp_{sem}")
|
| 257 |
+
sotcno = st.number_input(f"Số tín chỉ nợ - {sem}", 0, value=default_values[1] if default_values else 0, key=f"tcno_imp_{sem}")
|
| 258 |
+
with col2:
|
| 259 |
+
TBCHK = st.number_input(f"Điểm trung bình - {sem}", 0.0, 10.0, value=default_values[2] if default_values else 0.0, step=0.01, key=f"gpa_imp_{sem}")
|
| 260 |
+
|
| 261 |
+
# Collect semester data
|
| 262 |
+
data += [sotc_qua, sotcno, TBCHK]
|
| 263 |
+
|
| 264 |
final_features = np.array(data).reshape(1, -1)
|
| 265 |
|
| 266 |
# ===== Predict =====
|