Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +8 -4
src/streamlit_app.py
CHANGED
|
@@ -3,20 +3,24 @@ import pandas as pd
|
|
| 3 |
from evaluation import evaluate_submission
|
| 4 |
import os
|
| 5 |
import datetime
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
st.title("🏆 Hackathon Leaderboard")
|
| 10 |
|
| 11 |
uploaded_file = st.file_uploader("Upload your submission (.py)", type=["py"])
|
| 12 |
|
| 13 |
if uploaded_file:
|
| 14 |
-
|
|
|
|
| 15 |
f.write(uploaded_file.read())
|
| 16 |
|
| 17 |
-
# Here, you'd validate & evaluate
|
| 18 |
try:
|
| 19 |
-
score = evaluate_submission(
|
| 20 |
timestamp = datetime.datetime.now().isoformat()
|
| 21 |
entry = {"filename": uploaded_file.name, "score": score, "timestamp": timestamp}
|
| 22 |
|
|
|
|
| 3 |
from evaluation import evaluate_submission
|
| 4 |
import os
|
| 5 |
import datetime
|
| 6 |
+
import sys
|
| 7 |
|
| 8 |
+
# Make sure current directory includes parent of 'source'
|
| 9 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 10 |
+
|
| 11 |
+
LEADERBOARD_FILE = os.path.join(os.path.dirname(__file__), "..", "leaderboard.csv")
|
| 12 |
|
| 13 |
st.title("🏆 Hackathon Leaderboard")
|
| 14 |
|
| 15 |
uploaded_file = st.file_uploader("Upload your submission (.py)", type=["py"])
|
| 16 |
|
| 17 |
if uploaded_file:
|
| 18 |
+
temp_path = os.path.join(os.path.dirname(__file__), "submission_temp.py")
|
| 19 |
+
with open(temp_path, "wb") as f:
|
| 20 |
f.write(uploaded_file.read())
|
| 21 |
|
|
|
|
| 22 |
try:
|
| 23 |
+
score = evaluate_submission(temp_path) # Implement this
|
| 24 |
timestamp = datetime.datetime.now().isoformat()
|
| 25 |
entry = {"filename": uploaded_file.name, "score": score, "timestamp": timestamp}
|
| 26 |
|