Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -250,16 +250,26 @@ else:
|
|
| 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 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
final_features = np.array(data).reshape(1, -1)
|
| 265 |
|
|
|
|
| 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 |
+
if idx < 3: # First row (3 boxes)
|
| 254 |
+
with st.expander(f"📘 {sem}", expanded=True):
|
| 255 |
+
col1, col2, col3 = st.columns(3) # 3 columns for the first row
|
| 256 |
+
with col1:
|
| 257 |
+
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}")
|
| 258 |
+
with col2:
|
| 259 |
+
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}")
|
| 260 |
+
with col3:
|
| 261 |
+
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}")
|
| 262 |
+
else: # Second row (2 boxes)
|
| 263 |
+
with st.expander(f"📘 {sem}", expanded=True):
|
| 264 |
+
col1, col2 = st.columns(2) # 2 columns for the second row
|
| 265 |
+
with col1:
|
| 266 |
+
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}")
|
| 267 |
+
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}")
|
| 268 |
+
with col2:
|
| 269 |
+
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}")
|
| 270 |
+
|
| 271 |
+
# Collect semester data
|
| 272 |
+
data += [sotc_qua, sotcno, TBCHK]
|
| 273 |
|
| 274 |
final_features = np.array(data).reshape(1, -1)
|
| 275 |
|