Felladrin PierreMesure commited on
Commit
df30c7c
·
verified ·
1 Parent(s): 26600b8

Upload to same repo (#14)

Browse files

- Make it possible to upload to same repo (c09521cccb0f1a24ea8203eb079e829a00eccbc2)


Co-authored-by: Pierre Mesure <[email protected]>

Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -158,11 +158,23 @@ def main():
158
  key="user_hf_token",
159
  )
160
 
 
 
 
 
 
 
 
161
  model_name = input_model_id.split("/")[-1]
162
- output_model_id = f"{config.hf_username}/{model_name}-ONNX"
 
 
 
 
 
163
  output_model_url = f"{config.hf_base_url}/{output_model_id}"
164
 
165
- if converter.api.repo_exists(output_model_id):
166
  st.write("This model has already been converted! 🎉")
167
  st.link_button(f"Go to {output_model_id}", output_model_url, type="primary")
168
  return
 
158
  key="user_hf_token",
159
  )
160
 
161
+ if config.hf_username == input_model_id.split("/")[0]:
162
+ same_repo = st.checkbox(
163
+ "Do you want to upload the ONNX weights to the same repository?"
164
+ )
165
+ else:
166
+ same_repo = False
167
+
168
  model_name = input_model_id.split("/")[-1]
169
+
170
+ output_model_id = f"{config.hf_username}/{model_name}"
171
+
172
+ if not same_repo:
173
+ output_model_id += "-ONNX"
174
+
175
  output_model_url = f"{config.hf_base_url}/{output_model_id}"
176
 
177
+ if not same_repo and converter.api.repo_exists(output_model_id):
178
  st.write("This model has already been converted! 🎉")
179
  st.link_button(f"Go to {output_model_id}", output_model_url, type="primary")
180
  return