com3dian commited on
Commit
4fdeb8f
·
verified ·
1 Parent(s): 98d65c4

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -5
src/streamlit_app.py CHANGED
@@ -12,14 +12,13 @@ os.makedirs("submissions", exist_ok=True)
12
  # --- Submission Logic ---
13
  def handle_submission(file):
14
  if file is None:
15
- return "❌ No file uploaded.", None
16
 
17
- # Generate timestamped filename
18
  timestamp = datetime.datetime.now().isoformat().replace(":", "_")
19
  submission_filename = f"{timestamp}_{file.name}"
20
  submission_path = os.path.join("submissions", submission_filename)
21
 
22
- # Save file
23
  with open(submission_path, "wb") as f:
24
  f.write(file.read())
25
 
@@ -29,8 +28,9 @@ def handle_submission(file):
29
  except Exception as e:
30
  status = f"⚠️ Failed to upload to Google Drive: {e}"
31
 
32
- # Return status and updated leaderboard
33
- return status, get_leaderboard_html()
 
34
 
35
 
36
  # --- Leaderboard Logic ---
 
12
  # --- Submission Logic ---
13
  def handle_submission(file):
14
  if file is None:
15
+ return "❌ No file uploaded.", "<p>No leaderboard to show.</p>"
16
 
17
+ # Save file
18
  timestamp = datetime.datetime.now().isoformat().replace(":", "_")
19
  submission_filename = f"{timestamp}_{file.name}"
20
  submission_path = os.path.join("submissions", submission_filename)
21
 
 
22
  with open(submission_path, "wb") as f:
23
  f.write(file.read())
24
 
 
28
  except Exception as e:
29
  status = f"⚠️ Failed to upload to Google Drive: {e}"
30
 
31
+ leaderboard_html = get_leaderboard_html()
32
+ return status, leaderboard_html
33
+
34
 
35
 
36
  # --- Leaderboard Logic ---