Abhishek Thakur
commited on
Commit
·
470460b
1
Parent(s):
df36232
submission_desc
Browse files- competitions/competitions.py +4 -1
- competitions/info.py +14 -0
competitions/competitions.py
CHANGED
|
@@ -138,7 +138,10 @@ with gr.Blocks(css=".tabitem {padding: 25px}") as demo:
|
|
| 138 |
outputs=[output_text],
|
| 139 |
)
|
| 140 |
with gr.TabItem("My Submissions", id="my_submissions"):
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
| 142 |
user_token = gr.Textbox(
|
| 143 |
max_lines=1, value="", label="Please enter your Hugging Face token (read only)", type="password"
|
| 144 |
)
|
|
|
|
| 138 |
outputs=[output_text],
|
| 139 |
)
|
| 140 |
with gr.TabItem("My Submissions", id="my_submissions"):
|
| 141 |
+
if competition_info.submission_desc is None:
|
| 142 |
+
gr.Markdown(SUBMISSION_SELECTION_TEXT.format(competition_info.selection_limit))
|
| 143 |
+
else:
|
| 144 |
+
gr.Markdown(f"{competition_info.submission_desc}")
|
| 145 |
user_token = gr.Textbox(
|
| 146 |
max_lines=1, value="", label="Please enter your Hugging Face token (read only)", type="password"
|
| 147 |
)
|
competitions/info.py
CHANGED
|
@@ -41,6 +41,16 @@ class CompetitionInfo:
|
|
| 41 |
self.config = self.load_config(config_fname)
|
| 42 |
self.competition_desc = self.load_md(competition_desc)
|
| 43 |
self.dataset_desc = self.load_md(dataset_desc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
def load_md(self, md_path):
|
| 46 |
with open(md_path) as f:
|
|
@@ -82,6 +92,10 @@ class CompetitionInfo:
|
|
| 82 |
def submission_columns(self):
|
| 83 |
return self.config["SUBMISSION_COLUMNS"].split(",")
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
@property
|
| 86 |
def dataset_description(self):
|
| 87 |
return self.dataset_desc
|
|
|
|
| 41 |
self.config = self.load_config(config_fname)
|
| 42 |
self.competition_desc = self.load_md(competition_desc)
|
| 43 |
self.dataset_desc = self.load_md(dataset_desc)
|
| 44 |
+
try:
|
| 45 |
+
submission_desc = hf_hub_download(
|
| 46 |
+
repo_id=self.competition_id,
|
| 47 |
+
filename="SUBMISSION_DESC.md",
|
| 48 |
+
use_auth_token=self.autotrain_token,
|
| 49 |
+
repo_type="dataset",
|
| 50 |
+
)
|
| 51 |
+
self.submission_desc = self.load_md(submission_desc)
|
| 52 |
+
except Exception:
|
| 53 |
+
self.submission_desc = None
|
| 54 |
|
| 55 |
def load_md(self, md_path):
|
| 56 |
with open(md_path) as f:
|
|
|
|
| 92 |
def submission_columns(self):
|
| 93 |
return self.config["SUBMISSION_COLUMNS"].split(",")
|
| 94 |
|
| 95 |
+
@property
|
| 96 |
+
def submission_description(self):
|
| 97 |
+
return self.submission_desc
|
| 98 |
+
|
| 99 |
@property
|
| 100 |
def dataset_description(self):
|
| 101 |
return self.dataset_desc
|