com3dian commited on
Commit
5d56156
Β·
verified Β·
1 Parent(s): da7aa6e

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +30 -30
src/streamlit_app.py CHANGED
@@ -16,33 +16,33 @@ st.title("πŸ† Hackathon Leaderboard")
16
 
17
  uploaded_file = st.file_uploader("Upload your submission (.zip)", type=["zip"])
18
 
19
- if uploaded_file and st.button("Submit"):
20
- timestamp = datetime.datetime.now().isoformat()
21
- submission_filename = f"{timestamp.replace(':', '_')}_{uploaded_file.name}"
22
- submission_path = os.path.join("submissions", submission_filename)
23
- os.makedirs("submissions", exist_ok=True)
24
-
25
- # Save uploaded file
26
- with open(submission_path, "wb") as f:
27
- f.write(uploaded_file.read())
28
-
29
- try:
30
- drive_file_id = upload_to_drive(submission_path, submission_filename)
31
- st.success(f"Uploaded to Google Drive βœ… [File ID: {drive_file_id}]")
32
- except Exception as e:
33
- st.warning(f"Failed to upload to Google Drive: {e}")
34
-
35
- # ========================
36
- # Always Show Leaderboard
37
- # ========================
38
- st.subheader("Leaderboard")
39
-
40
- try:
41
- df = fetch_leaderboard()
42
- if not df.empty:
43
- df_sorted = df.sort_values(by="score", ascending=False)
44
- st.dataframe(df_sorted)
45
- else:
46
- st.info("No submissions yet.")
47
- except Exception as e:
48
- st.warning(f"Could not load leaderboard: {e}")
 
16
 
17
  uploaded_file = st.file_uploader("Upload your submission (.zip)", type=["zip"])
18
 
19
+ # if uploaded_file and st.button("Submit"):
20
+ # timestamp = datetime.datetime.now().isoformat()
21
+ # submission_filename = f"{timestamp.replace(':', '_')}_{uploaded_file.name}"
22
+ # submission_path = os.path.join("submissions", submission_filename)
23
+ # os.makedirs("submissions", exist_ok=True)
24
+
25
+ # # Save uploaded file
26
+ # with open(submission_path, "wb") as f:
27
+ # f.write(uploaded_file.read())
28
+
29
+ # try:
30
+ # drive_file_id = upload_to_drive(submission_path, submission_filename)
31
+ # st.success(f"Uploaded to Google Drive βœ… [File ID: {drive_file_id}]")
32
+ # except Exception as e:
33
+ # st.warning(f"Failed to upload to Google Drive: {e}")
34
+
35
+ # # ========================
36
+ # # Always Show Leaderboard
37
+ # # ========================
38
+ # st.subheader("Leaderboard")
39
+
40
+ # try:
41
+ # df = fetch_leaderboard()
42
+ # if not df.empty:
43
+ # df_sorted = df.sort_values(by="score", ascending=False)
44
+ # st.dataframe(df_sorted)
45
+ # else:
46
+ # st.info("No submissions yet.")
47
+ # except Exception as e:
48
+ # st.warning(f"Could not load leaderboard: {e}")