Spaces:
Running
Running
Update app.py
Browse fileschanging `model_type` to `task`
app.py
CHANGED
|
@@ -16,6 +16,9 @@ REQUESTS_DATASET_PATH = f"{OWNER}/requests_debug"
|
|
| 16 |
TOKEN = os.environ.get("DEBUG")
|
| 17 |
API = HfApi(token=TOKEN)
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
##### Data classes need for the leaderboard Submit Model menu. #####
|
|
@@ -95,7 +98,7 @@ def add_new_eval(
|
|
| 95 |
revision: str,
|
| 96 |
precision: str,
|
| 97 |
weight_type: str,
|
| 98 |
-
|
| 99 |
):
|
| 100 |
model_owner = repo_id.split("/")[0]
|
| 101 |
model_name = repo_id.split("/")[1]
|
|
@@ -103,8 +106,6 @@ def add_new_eval(
|
|
| 103 |
|
| 104 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 105 |
|
| 106 |
-
#if model_type is None or model_type == "":
|
| 107 |
-
# return styled_error("Please select a model type.")
|
| 108 |
|
| 109 |
# Does the model actually exist?
|
| 110 |
#if revision == "":
|
|
@@ -151,7 +152,7 @@ def add_new_eval(
|
|
| 151 |
"weight_type": weight_type,
|
| 152 |
"status": "PENDING",
|
| 153 |
"submitted_time": current_time,
|
| 154 |
-
"
|
| 155 |
"likes": model_info.likes,
|
| 156 |
"params": model_size}
|
| 157 |
#"license": license,
|
|
@@ -201,11 +202,10 @@ with gr.Blocks() as demo:
|
|
| 201 |
with gr.Column():
|
| 202 |
model_name_textbox = gr.Textbox(label="Model name", value="lvwerra/distilbert-imdb")
|
| 203 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
| 204 |
-
|
| 205 |
-
choices=
|
| 206 |
-
label="
|
| 207 |
multiselect=False,
|
| 208 |
-
value=ModelType.PT.to_str(" : "),
|
| 209 |
interactive=True,
|
| 210 |
)
|
| 211 |
|
|
@@ -236,7 +236,7 @@ with gr.Blocks() as demo:
|
|
| 236 |
revision_name_textbox,
|
| 237 |
precision,
|
| 238 |
weight_type,
|
| 239 |
-
|
| 240 |
],
|
| 241 |
outputs=submission_result,
|
| 242 |
)
|
|
|
|
| 16 |
TOKEN = os.environ.get("DEBUG")
|
| 17 |
API = HfApi(token=TOKEN)
|
| 18 |
|
| 19 |
+
tasks = ['asr.csv', 'object_detection.csv', 'text_classification.csv', 'image_captioning.csv',
|
| 20 |
+
'question_answering.csv', 'text_generation.csv', 'image_classification.csv',
|
| 21 |
+
'sentence_similarity.csv', 'image_generation.csv', 'summarization.csv']
|
| 22 |
|
| 23 |
|
| 24 |
##### Data classes need for the leaderboard Submit Model menu. #####
|
|
|
|
| 98 |
revision: str,
|
| 99 |
precision: str,
|
| 100 |
weight_type: str,
|
| 101 |
+
task: str,
|
| 102 |
):
|
| 103 |
model_owner = repo_id.split("/")[0]
|
| 104 |
model_name = repo_id.split("/")[1]
|
|
|
|
| 106 |
|
| 107 |
current_time = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 108 |
|
|
|
|
|
|
|
| 109 |
|
| 110 |
# Does the model actually exist?
|
| 111 |
#if revision == "":
|
|
|
|
| 152 |
"weight_type": weight_type,
|
| 153 |
"status": "PENDING",
|
| 154 |
"submitted_time": current_time,
|
| 155 |
+
"task": task,
|
| 156 |
"likes": model_info.likes,
|
| 157 |
"params": model_size}
|
| 158 |
#"license": license,
|
|
|
|
| 202 |
with gr.Column():
|
| 203 |
model_name_textbox = gr.Textbox(label="Model name", value="lvwerra/distilbert-imdb")
|
| 204 |
revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
|
| 205 |
+
task = gr.Dropdown(
|
| 206 |
+
choices=tasks,
|
| 207 |
+
label="Tasks",
|
| 208 |
multiselect=False,
|
|
|
|
| 209 |
interactive=True,
|
| 210 |
)
|
| 211 |
|
|
|
|
| 236 |
revision_name_textbox,
|
| 237 |
precision,
|
| 238 |
weight_type,
|
| 239 |
+
task,
|
| 240 |
],
|
| 241 |
outputs=submission_result,
|
| 242 |
)
|