Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,29 @@ from src.submission.submit import add_new_eval
|
|
31 |
|
32 |
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
import json
|
35 |
def print_first_json_content(directory):
|
36 |
for root, dirs, files in os.walk(directory):
|
@@ -73,6 +96,7 @@ def download_dataset(repo_id, local_dir):
|
|
73 |
#download_dataset("https://huggingface.co/datasets/open-llm-leaderboard/requests", "new/requests")
|
74 |
#download_dataset("datasets/open-llm-leaderboard/results", "new/results")
|
75 |
|
|
|
76 |
|
77 |
def restart_space():
|
78 |
API.restart_space(repo_id=REPO_ID, token=TOKEN)
|
|
|
31 |
|
32 |
|
33 |
|
34 |
+
|
35 |
+
# blz -------------------------
|
36 |
+
|
37 |
+
|
38 |
+
import builtins
|
39 |
+
|
40 |
+
# Global counter for file openings
|
41 |
+
file_open_count = 0
|
42 |
+
|
43 |
+
# Original open function
|
44 |
+
original_open = builtins.open
|
45 |
+
|
46 |
+
def custom_open(*args, **kwargs):
|
47 |
+
global file_open_count
|
48 |
+
# The first argument is usually the file name/path
|
49 |
+
file_name = args[0] if args else kwargs.get('file', 'Unknown')
|
50 |
+
|
51 |
+
if 'r' in args or kwargs.get('mode', 'r').startswith('r'):
|
52 |
+
file_open_count += 1
|
53 |
+
print(f"File '{file_name}' opened for reading. Total count: {file_open_count}")
|
54 |
+
|
55 |
+
return original_open(*args, **kwargs)
|
56 |
+
|
57 |
import json
|
58 |
def print_first_json_content(directory):
|
59 |
for root, dirs, files in os.walk(directory):
|
|
|
96 |
#download_dataset("https://huggingface.co/datasets/open-llm-leaderboard/requests", "new/requests")
|
97 |
#download_dataset("datasets/open-llm-leaderboard/results", "new/results")
|
98 |
|
99 |
+
# blz end -------------------
|
100 |
|
101 |
def restart_space():
|
102 |
API.restart_space(repo_id=REPO_ID, token=TOKEN)
|