Update app.py
Browse files
app.py
CHANGED
@@ -221,8 +221,20 @@ def update_leaderboard(results):
|
|
221 |
header=not os.path.exists(LEADERBOARD_FILE) # Add headers if file doesn't exist
|
222 |
)
|
223 |
print("Leaderboard file updated successfully.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
except Exception as e:
|
225 |
-
print(f"Error
|
|
|
226 |
|
227 |
|
228 |
|
|
|
221 |
header=not os.path.exists(LEADERBOARD_FILE) # Add headers if file doesn't exist
|
222 |
)
|
223 |
print("Leaderboard file updated successfully.")
|
224 |
+
# Push the updated file to the Hugging Face repository
|
225 |
+
repo = Repository(
|
226 |
+
local_dir=".", # Current working directory
|
227 |
+
clone_from="SondosMB/ss", # Replace with your space's repository name
|
228 |
+
use_auth_token=True
|
229 |
+
)
|
230 |
+
repo.git_add(LEADERBOARD_FILE)
|
231 |
+
repo.git_commit(f"Update leaderboard: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
232 |
+
repo.git_push()
|
233 |
+
print("Leaderboard changes pushed to Hugging Face repository.")
|
234 |
+
|
235 |
except Exception as e:
|
236 |
+
print(f"Error updating leaderboard file: {e}")
|
237 |
+
|
238 |
|
239 |
|
240 |
|