Adam Jirkovsky commited on
Commit
ae3034b
·
1 Parent(s): 38ca6d6

Revert GUI changes

Browse files
Files changed (1) hide show
  1. app.py +57 -54
app.py CHANGED
@@ -30,9 +30,6 @@ from src.display.utils import (
30
  from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, TOKEN, QUEUE_REPO, REPO_ID, RESULTS_REPO
31
  from src.populate import get_evaluation_queue_df, get_leaderboard_df
32
  from src.submission.submit import add_new_eval
33
- from captcha.image import ImageCaptcha
34
- from PIL import Image
35
- import random, string
36
 
37
 
38
  original_df = None
@@ -156,14 +153,6 @@ def validate_upload(input):
156
  raise gr.Error("Cannot parse file")
157
 
158
 
159
- def generate_captcha(width=200, height=150, length=4):
160
- text = ''.join(random.choices(string.ascii_uppercase + string.digits, k=length))
161
- captcha_obj = ImageCaptcha(width, height)
162
- data = captcha_obj.generate(text)
163
- image = Image.open(data)
164
- return image, text
165
-
166
-
167
 
168
  demo = gr.Blocks(css=custom_css)
169
  with demo:
@@ -298,7 +287,6 @@ with demo:
298
  datatype=EVAL_TYPES,
299
  row_count=5,
300
  )
301
-
302
  with gr.Accordion(
303
  f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
304
  open=False,
@@ -316,47 +304,62 @@ with demo:
316
 
317
  with gr.Row():
318
  with gr.Column():
319
- with gr.Group():
320
- model_name_textbox = gr.Textbox(label="Model name")
321
- #precision = gr.Radio(["bfloat16", "float16", "4bit"], label="Precision", info="What precision are you using for inference?")
322
- precision = gr.Dropdown(
323
- choices=[i.value.name for i in Precision if i != Precision.Unknown],
324
- label="Precision",
325
- multiselect=False,
326
- value="other",
327
- interactive=True,
328
- info="What weight precision were you using during the evaluation?"
329
- )
330
- hf_model_id = gr.Textbox(label="Model link (Optional)", info="URL to the model's Hugging Face repository, or it's official website")
331
- contact_email = gr.Textbox(label="Your E-Mail")
332
- file_input = gr.File(file_count="single", interactive=True)
333
- #file_input.upload(validate_upload, file_input)
334
- upload_button = gr.UploadButton("Upload json", file_types=['.json'])
335
- upload_button.upload(validate_upload, upload_button, file_input)
336
-
337
- with gr.Group():
338
- image, text = generate_captcha()
339
- captcha_img = gr.Image(
340
- image,
341
- #container=False,
342
- show_download_button=False,
343
- show_fullscreen_button=False,
344
- show_share_button=False,
345
- )
346
- captcha_input = gr.Textbox(placeholder="Enter the text in the image above", show_label=False, container=False)
347
- submit_button = gr.Button("Submit Eval", interactive=True)
348
- submission_result = gr.Markdown()
349
- submit_button.click(
350
- fn = add_new_eval,
351
- inputs = [
352
- model_name_textbox,
353
- file_input,
354
- precision,
355
- hf_model_id,
356
- contact_email
357
- ],
358
- outputs = [submission_result, model_name_textbox, precision, hf_model_id, contact_email],
359
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
  with gr.Row():
362
  with gr.Accordion("📙 Citation", open=False):
@@ -371,4 +374,4 @@ with demo:
371
  #scheduler = BackgroundScheduler()
372
  #scheduler.add_job(restart_space, "interval", seconds=3600)
373
  #scheduler.start()
374
- demo.queue(default_concurrency_limit=40).launch(server_name="0.0.0.0")
 
30
  from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, TOKEN, QUEUE_REPO, REPO_ID, RESULTS_REPO
31
  from src.populate import get_evaluation_queue_df, get_leaderboard_df
32
  from src.submission.submit import add_new_eval
 
 
 
33
 
34
 
35
  original_df = None
 
153
  raise gr.Error("Cannot parse file")
154
 
155
 
 
 
 
 
 
 
 
 
156
 
157
  demo = gr.Blocks(css=custom_css)
158
  with demo:
 
287
  datatype=EVAL_TYPES,
288
  row_count=5,
289
  )
 
290
  with gr.Accordion(
291
  f"⏳ Pending Evaluation Queue ({len(pending_eval_queue_df)})",
292
  open=False,
 
304
 
305
  with gr.Row():
306
  with gr.Column():
307
+ model_name_textbox = gr.Textbox(label="Model name")
308
+ #precision = gr.Radio(["bfloat16", "float16", "4bit"], label="Precision", info="What precision are you using for inference?")
309
+ precision = gr.Dropdown(
310
+ choices=[i.value.name for i in Precision if i != Precision.Unknown],
311
+ label="Precision",
312
+ multiselect=False,
313
+ value="other",
314
+ interactive=True,
315
+ info="What weight precision were you using during the evaluation?"
316
+ )
317
+ hf_model_id = gr.Textbox(label="Model link (Optional)", info="URL to the model's Hugging Face repository, or it's official website")
318
+ contact_email = gr.Textbox(label="Your E-Mail")
319
+ file_output = gr.File()
320
+ upload_button = gr.UploadButton("Upload json", file_types=['.json'])
321
+ upload_button.upload(validate_upload, upload_button, file_output)
322
+ """
323
+ revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")
324
+ model_type = gr.Dropdown(
325
+ choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],
326
+ label="Model type",
327
+ multiselect=False,
328
+ value=None,
329
+ interactive=True,
330
+ )
331
+ """
332
+ """
333
+ with gr.Column():
334
+ precision = gr.Dropdown(
335
+ choices=[i.value.name for i in Precision if i != Precision.Unknown],
336
+ label="Precision",
337
+ multiselect=False,
338
+ value="float16",
339
+ interactive=True,
340
+ )
341
+ weight_type = gr.Dropdown(
342
+ choices=[i.value.name for i in WeightType],
343
+ label="Weights type",
344
+ multiselect=False,
345
+ value="Original",
346
+ interactive=True,
347
+ )
348
+ base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
349
+ """
350
+ submit_button = gr.Button("Submit Eval", interactive=True)
351
+ submission_result = gr.Markdown()
352
+ submit_button.click(
353
+ fn = add_new_eval,
354
+ inputs = [
355
+ model_name_textbox,
356
+ upload_button,
357
+ precision,
358
+ hf_model_id,
359
+ contact_email
360
+ ],
361
+ outputs = [submission_result, model_name_textbox, precision, hf_model_id, contact_email],
362
+ )
363
 
364
  with gr.Row():
365
  with gr.Accordion("📙 Citation", open=False):
 
374
  #scheduler = BackgroundScheduler()
375
  #scheduler.add_job(restart_space, "interval", seconds=3600)
376
  #scheduler.start()
377
+ demo.queue(default_concurrency_limit=40).launch(server_name="0.0.0.0")