Spaces:
Runtime error
Runtime error
Commit
·
7ecd1ad
1
Parent(s):
b20983f
fix bug
Browse files
app.py
CHANGED
|
@@ -82,13 +82,14 @@ def build_demo():
|
|
| 82 |
gr.Markdown("# ✨ Submit your model here!", elem_classes="markdown-text")
|
| 83 |
|
| 84 |
with gr.Column():
|
| 85 |
-
file_input = gr.File(label="Upload File")
|
| 86 |
model_name_input = gr.Textbox(label="Model name")
|
| 87 |
username_input = gr.Textbox(label="Username") # can we get this info from hf??
|
| 88 |
link_input = gr.Textbox(label="Link to Model") # can we get this info from hf??
|
|
|
|
|
|
|
| 89 |
|
| 90 |
submit_button = gr.Button("Submit")
|
| 91 |
-
|
| 92 |
|
| 93 |
submit_button.click(
|
| 94 |
fn=upload_file,
|
|
@@ -101,7 +102,7 @@ def upload_file(file, model_name, username, link):
|
|
| 101 |
return "Fields file, model_name and username are required"
|
| 102 |
|
| 103 |
file_name = file.name.split("/")[-1] if "/" in file.name else file.name
|
| 104 |
-
file_name = model_name
|
| 105 |
|
| 106 |
with open(f"{DATA_PATH}/{SUBMITS_META_FILE}", "r", encoding="utf-8") as submit_meta_file:
|
| 107 |
current_info = json.loads(submit_meta_file)
|
|
|
|
| 82 |
gr.Markdown("# ✨ Submit your model here!", elem_classes="markdown-text")
|
| 83 |
|
| 84 |
with gr.Column():
|
|
|
|
| 85 |
model_name_input = gr.Textbox(label="Model name")
|
| 86 |
username_input = gr.Textbox(label="Username") # can we get this info from hf??
|
| 87 |
link_input = gr.Textbox(label="Link to Model") # can we get this info from hf??
|
| 88 |
+
|
| 89 |
+
file_input = gr.File(label="Upload File")
|
| 90 |
|
| 91 |
submit_button = gr.Button("Submit")
|
| 92 |
+
submit_output = gr.Markdown("", elem_classes="markdown-text")
|
| 93 |
|
| 94 |
submit_button.click(
|
| 95 |
fn=upload_file,
|
|
|
|
| 102 |
return "Fields file, model_name and username are required"
|
| 103 |
|
| 104 |
file_name = file.name.split("/")[-1] if "/" in file.name else file.name
|
| 105 |
+
file_name = model_name + "_" + file_name
|
| 106 |
|
| 107 |
with open(f"{DATA_PATH}/{SUBMITS_META_FILE}", "r", encoding="utf-8") as submit_meta_file:
|
| 108 |
current_info = json.loads(submit_meta_file)
|