hSterz commited on
Commit
b977ee0
·
1 Parent(s): 9bd165f
Files changed (1) hide show
  1. app.py +10 -41
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
3
  import pandas as pd
4
  from apscheduler.schedulers.background import BackgroundScheduler
@@ -79,6 +80,10 @@ def init_leaderboard(dataframe):
79
  interactive=False,
80
  )
81
 
 
 
 
 
82
 
83
  demo = gr.Blocks(css=custom_css)
84
  with demo:
@@ -139,48 +144,12 @@ with demo:
139
  gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
140
 
141
  with gr.Row():
142
- with gr.Column():
143
- model_name_textbox = gr.Textbox(label="Model name")
144
- revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
145
- model_type = gr.Dropdown(
146
- choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
147
- label="Model type",
148
- multiselect=False,
149
- value=None,
150
- interactive=True,
151
- )
152
 
153
- with gr.Column():
154
- precision = gr.Dropdown(
155
- choices=[i.value.name for i in Precision if i != Precision.Unknown],
156
- label="Precision",
157
- multiselect=False,
158
- value="float16",
159
- interactive=True,
160
- )
161
- weight_type = gr.Dropdown(
162
- choices=[i.value.name for i in WeightType],
163
- label="Weights type",
164
- multiselect=False,
165
- value="Original",
166
- interactive=True,
167
- )
168
- base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
169
-
170
- submit_button = gr.Button("Submit Eval")
171
- submission_result = gr.Markdown()
172
- submit_button.click(
173
- add_new_eval,
174
- [
175
- model_name_textbox,
176
- base_model_name_textbox,
177
- revision_name_textbox,
178
- precision,
179
- weight_type,
180
- model_type,
181
- ],
182
- submission_result,
183
- )
184
 
185
  with gr.Row():
186
  with gr.Accordion("📙 Citation", open=False):
 
1
  import gradio as gr
2
+ from pathlib import Path
3
  from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns
4
  import pandas as pd
5
  from apscheduler.schedulers.background import BackgroundScheduler
 
80
  interactive=False,
81
  )
82
 
83
+ def upload_file(filepath):
84
+ name = Path(filepath).name
85
+ return [gr.UploadButton(visible=False), gr.DownloadButton(label=f"Download {name}", value=filepath, visible=True)]
86
+
87
 
88
  demo = gr.Blocks(css=custom_css)
89
  with demo:
 
144
  gr.Markdown("# ✉️✨ Submit your model here!", elem_classes="markdown-text")
145
 
146
  with gr.Row():
147
+ u = gr.UploadButton("Upload a file", file_count="single")
148
+ d = gr.DownloadButton("Download the file", visible=False)
 
 
 
 
 
 
 
 
149
 
150
+ u.upload(upload_file, u, [u, d])
151
+
152
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  with gr.Row():
155
  with gr.Accordion("📙 Citation", open=False):