tttoaster commited on
Commit
f5bfcdc
1 Parent(s): 5f45322

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -6,12 +6,19 @@ import pandas as pd
6
  import json
7
  import pdb
8
  import tempfile
 
9
 
10
  from constants import *
11
  from src.auto_leaderboard.model_metadata_type import ModelType
12
 
13
  global data_component, filter_component
14
 
 
 
 
 
 
 
15
 
16
  def upload_file(files):
17
  file_paths = [file.name for file in files]
@@ -112,6 +119,7 @@ def add_new_eval(
112
  if input_file is None:
113
  return "Error! Empty file!"
114
  else:
 
115
  # v1 evaluation
116
  if benchmark_version == 'v1':
117
  content = input_file.decode("utf-8")
@@ -547,7 +555,7 @@ with block:
547
  label="Model Link", placeholder="https://huggingface.co/decapoda-research/llama-7b-hf"
548
  )
549
  model_size = gr.Textbox(
550
- label="Model size", placeholder="7B(Input content format must be 'number+B' or '-')"
551
  )
552
  benchmark_version= gr.Dropdown(
553
  choices=["v1", "v2"],
 
6
  import json
7
  import pdb
8
  import tempfile
9
+ import re
10
 
11
  from constants import *
12
  from src.auto_leaderboard.model_metadata_type import ModelType
13
 
14
  global data_component, filter_component
15
 
16
+ def validate_model_size(s):
17
+ pattern = r'^\d+B$|^-$'
18
+ if re.match(pattern, s):
19
+ return s
20
+ else:
21
+ return '-'
22
 
23
  def upload_file(files):
24
  file_paths = [file.name for file in files]
 
119
  if input_file is None:
120
  return "Error! Empty file!"
121
  else:
122
+ model_size = validate_model_size(model_size)
123
  # v1 evaluation
124
  if benchmark_version == 'v1':
125
  content = input_file.decode("utf-8")
 
555
  label="Model Link", placeholder="https://huggingface.co/decapoda-research/llama-7b-hf"
556
  )
557
  model_size = gr.Textbox(
558
+ label="Model size", placeholder="7B(Input content format must be 'number+B' or '-', default is '-')"
559
  )
560
  benchmark_version= gr.Dropdown(
561
  choices=["v1", "v2"],