Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- 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.",
|
| 16 |
|
| 17 |
-
#
|
| 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 |
-
|
| 33 |
-
return status,
|
|
|
|
| 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 ---
|