namngo commited on
Commit
6566b9e
·
verified ·
1 Parent(s): 645e5c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -13
app.py CHANGED
@@ -48,20 +48,10 @@ def save_to_gsheet(name, student_id, major, prediction, sheet_name="Trang tính1
48
  now = datetime.now()
49
  current_time = now.strftime("%Y-%m-%d %H:%M:%S")
50
 
51
- # If prediction is a NumPy ndarray, convert it to a scalar or list
52
- if isinstance(prediction, np.ndarray):
53
- prediction = prediction.tolist() # Convert ndarray to list
54
- else:
55
- prediction = str(prediction) # Ensure it's a string if it's not a list
56
-
57
- # Convert prediction to "Đúng hạn" or "Không đúng hạn"
58
- if prediction == 1:
59
- prediction_result = "Đúng hạn"
60
- else:
61
- prediction_result = "Không đúng hạn"
62
 
63
  # Create a data row to insert into the sheet
64
- data_row = [name, student_id, major, prediction_result, current_time]
65
 
66
  # Connect to Google Sheets
67
  client = get_gsheet_client()
@@ -255,4 +245,4 @@ if st.button("🎯 DỰ BÁO"):
255
  # st.write("Available sheet names:", sheet_names)
256
 
257
  # Ghi log lên Google Sheets
258
- save_to_gsheet(name, student_id, major, prediction[0])
 
48
  now = datetime.now()
49
  current_time = now.strftime("%Y-%m-%d %H:%M:%S")
50
 
51
+
 
 
 
 
 
 
 
 
 
 
52
 
53
  # Create a data row to insert into the sheet
54
+ data_row = [name, student_id, major, prediction, current_time]
55
 
56
  # Connect to Google Sheets
57
  client = get_gsheet_client()
 
245
  # st.write("Available sheet names:", sheet_names)
246
 
247
  # Ghi log lên Google Sheets
248
+ save_to_gsheet(name, student_id, major, prediction)