Spaces:
Running
Running
Add environment variables for testing purpose
Browse files
app.py
CHANGED
@@ -17,6 +17,10 @@ from content import (
|
|
17 |
)
|
18 |
from server import LeaderboardServer, xmlAndMarkdownEscape, xmlQuoteAttr
|
19 |
|
|
|
|
|
|
|
|
|
20 |
leaderboard_server = LeaderboardServer()
|
21 |
|
22 |
|
@@ -61,7 +65,10 @@ def process_submission(*inputs):
|
|
61 |
|
62 |
gr.Info('Submission valid, going to queue for the tournament…')
|
63 |
|
64 |
-
|
|
|
|
|
|
|
65 |
except ValueError as err:
|
66 |
gr.Warning(str(err))
|
67 |
return (
|
@@ -85,10 +92,18 @@ def process_submission(*inputs):
|
|
85 |
|
86 |
gr.Info('Tournament finished!', duration=5)
|
87 |
gr.Info('You can see the results of your model below.', duration=15)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
return (
|
89 |
gr.update(visible=False),
|
90 |
-
|
91 |
-
|
92 |
gr.update(interactive=True, visible=True),
|
93 |
gr.update(visible=True),
|
94 |
gr.update(
|
|
|
17 |
)
|
18 |
from server import LeaderboardServer, xmlAndMarkdownEscape, xmlQuoteAttr
|
19 |
|
20 |
+
# For testing purpose
|
21 |
+
HF_DISABLE_SUBMIT = bool(int(os.environ.get("HF_DISABLE_SUBMIT", "0")))
|
22 |
+
HF_FAKE_TOURNAMENT = bool(int(os.environ.get("HF_FAKE_TOURNAMENT", "0")))
|
23 |
+
|
24 |
leaderboard_server = LeaderboardServer()
|
25 |
|
26 |
|
|
|
65 |
|
66 |
gr.Info('Submission valid, going to queue for the tournament…')
|
67 |
|
68 |
+
if HF_FAKE_TOURNAMENT:
|
69 |
+
pre_submit = None
|
70 |
+
else:
|
71 |
+
pre_submit = leaderboard_server.prepare_model_for_submission(inputs["submission_file"], metadata)
|
72 |
except ValueError as err:
|
73 |
gr.Warning(str(err))
|
74 |
return (
|
|
|
92 |
|
93 |
gr.Info('Tournament finished!', duration=5)
|
94 |
gr.Info('You can see the results of your model below.', duration=15)
|
95 |
+
|
96 |
+
if HF_DISABLE_SUBMIT:
|
97 |
+
submit_prompt = gr.update(visible=False)
|
98 |
+
submission_btn_yes = gr.update(visible=False)
|
99 |
+
else:
|
100 |
+
submit_prompt = gr.update(visible=True)
|
101 |
+
submission_btn_yes = gr.update(interactive=True, visible=True)
|
102 |
+
|
103 |
return (
|
104 |
gr.update(visible=False),
|
105 |
+
submit_prompt,
|
106 |
+
submission_btn_yes,
|
107 |
gr.update(interactive=True, visible=True),
|
108 |
gr.update(visible=True),
|
109 |
gr.update(
|