multimodalart HF staff commited on
Commit
3cdd29f
1 Parent(s): a569c7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -105,12 +105,13 @@ def upload_stage1_result(stage1_param_path: str, stage1_result_path: str,
105
  if not UPLOAD_REPO_ID:
106
  return
107
  try:
 
108
  hf_api.upload_file(path_or_fileobj=stage1_param_path,
109
- path_in_repo=f'stage1_params/{save_name}.json',
110
  repo_id=UPLOAD_REPO_ID,
111
  repo_type='dataset')
112
  hf_api.upload_file(path_or_fileobj=stage1_result_path,
113
- path_in_repo=f'stage1_results/{save_name}.pth',
114
  repo_id=UPLOAD_REPO_ID,
115
  repo_type='dataset')
116
  except Exception as e:
@@ -141,13 +142,14 @@ def upload_stage2_info(stage1_param_file_hash_name: str,
141
  save_name = f'{stage1_param_file_hash_name}_{stage2_param_file_hash_name}'
142
 
143
  try:
 
144
  hf_api.upload_file(path_or_fileobj=param_file.name,
145
- path_in_repo=f'stage2_params/{save_name}.json',
146
  repo_id=UPLOAD_REPO_ID,
147
  repo_type='dataset')
148
  if UPLOAD_RESULT_IMAGE:
149
  hf_api.upload_file(path_or_fileobj=stage2_output_path,
150
- path_in_repo=f'stage2_results/{save_name}.png',
151
  repo_id=UPLOAD_REPO_ID,
152
  repo_type='dataset')
153
  except Exception as e:
@@ -186,8 +188,9 @@ def upload_stage2_3_info(stage1_param_file_hash_name: str,
186
  save_name = f'{stage1_param_file_hash_name}_{stage2_3_param_file_hash_name}'
187
 
188
  try:
 
189
  hf_api.upload_file(path_or_fileobj=param_file.name,
190
- path_in_repo=f'stage2_3_params/{save_name}.json',
191
  repo_id=UPLOAD_REPO_ID,
192
  repo_type='dataset')
193
  if UPLOAD_RESULT_IMAGE:
 
105
  if not UPLOAD_REPO_ID:
106
  return
107
  try:
108
+ random_folder = random.randint(0,1000)
109
  hf_api.upload_file(path_or_fileobj=stage1_param_path,
110
+ path_in_repo=f'stage1_params/{random_folder}/{save_name}.json',
111
  repo_id=UPLOAD_REPO_ID,
112
  repo_type='dataset')
113
  hf_api.upload_file(path_or_fileobj=stage1_result_path,
114
+ path_in_repo=f'stage1_results/{random_folder}/{save_name}.pth',
115
  repo_id=UPLOAD_REPO_ID,
116
  repo_type='dataset')
117
  except Exception as e:
 
142
  save_name = f'{stage1_param_file_hash_name}_{stage2_param_file_hash_name}'
143
 
144
  try:
145
+ random_folder = random.randint(0,1000)
146
  hf_api.upload_file(path_or_fileobj=param_file.name,
147
+ path_in_repo=f'stage2_params/{random_folder}/{save_name}.json',
148
  repo_id=UPLOAD_REPO_ID,
149
  repo_type='dataset')
150
  if UPLOAD_RESULT_IMAGE:
151
  hf_api.upload_file(path_or_fileobj=stage2_output_path,
152
+ path_in_repo=f'stage2_results/{random_folder}/{save_name}.png',
153
  repo_id=UPLOAD_REPO_ID,
154
  repo_type='dataset')
155
  except Exception as e:
 
188
  save_name = f'{stage1_param_file_hash_name}_{stage2_3_param_file_hash_name}'
189
 
190
  try:
191
+ random_folder = random.randint(0,1000)
192
  hf_api.upload_file(path_or_fileobj=param_file.name,
193
+ path_in_repo=f'stage2_3_params/{random_folder}/{save_name}.json',
194
  repo_id=UPLOAD_REPO_ID,
195
  repo_type='dataset')
196
  if UPLOAD_RESULT_IMAGE: