Terry Zhuo commited on
Commit
7f77e31
·
1 Parent(s): 9f3c532
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -21,7 +21,7 @@ def generate_command(
21
  ):
22
  command = [default_command]
23
 
24
- if jsonl_file.name is not None:
25
  # Copy the uploaded file to the current directory
26
  local_filename = os.path.basename(jsonl_file.name)
27
  shutil.copy(jsonl_file.name, local_filename)
@@ -49,7 +49,10 @@ def generate_command(
49
 
50
 
51
  def cleanup_previous_files(jsonl_file):
52
- file_list = ['Dockerfile', 'app.py', 'README.md', os.path.basename(jsonl_file.name), "__pycache__"]
 
 
 
53
  for file in glob.glob("*"):
54
  try:
55
  if file not in file_list:
@@ -147,7 +150,7 @@ with gr.Blocks() as demo:
147
 
148
  def start_evaluation(command, jsonl_file, subset, split):
149
  extra = subset + "_" if subset != "full" else ""
150
- if jsonl_file.name is not None:
151
  result_path = os.path.basename(jsonl_file.name).replace(".jsonl", f"_{extra}eval_results.json")
152
 
153
  for log in stream_logs(command, jsonl_file):
 
21
  ):
22
  command = [default_command]
23
 
24
+ if jsonl_file is not None:
25
  # Copy the uploaded file to the current directory
26
  local_filename = os.path.basename(jsonl_file.name)
27
  shutil.copy(jsonl_file.name, local_filename)
 
49
 
50
 
51
  def cleanup_previous_files(jsonl_file):
52
+ if jsonl_file is not None:
53
+ file_list = ['Dockerfile', 'app.py', 'README.md', os.path.basename(jsonl_file.name), "__pycache__"]
54
+ else:
55
+ file_list = ['Dockerfile', 'app.py', 'README.md', "__pycache__"]
56
  for file in glob.glob("*"):
57
  try:
58
  if file not in file_list:
 
150
 
151
  def start_evaluation(command, jsonl_file, subset, split):
152
  extra = subset + "_" if subset != "full" else ""
153
+ if jsonl_file is not None:
154
  result_path = os.path.basename(jsonl_file.name).replace(".jsonl", f"_{extra}eval_results.json")
155
 
156
  for log in stream_logs(command, jsonl_file):