Spaces:
Runtime error
Runtime error
Added target file existence check for incremental upload. (#4)
Browse files- Added target file existence check for incremental upload. (44a3f09f997825266af5a4e12a0ecab0e26e6a08)
Co-authored-by: Itai I. <Symbiomatrix@users.noreply.huggingface.co>
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import requests
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
-
from huggingface_hub import update_repo_visibility, whoami, upload_folder, create_repo, upload_file, update_repo_visibility
|
5 |
import subprocess
|
6 |
|
7 |
import gradio as gr
|
@@ -117,6 +117,13 @@ def process_url(url, profile, user_repo_id, oauth_token, folder, api_key=None):
|
|
117 |
try:
|
118 |
download_url = data['downloadUrl']
|
119 |
filename = dl_path.split('/')[-1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
gr.Info(f"Downloading {filename} ({current_file}/{total_files})")
|
121 |
download_file(download_url, dl_path, folder, api_key)
|
122 |
# Upload the model and card
|
|
|
1 |
import requests
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
+
from huggingface_hub import update_repo_visibility, whoami, upload_folder, create_repo, upload_file, update_repo_visibility, file_exists
|
5 |
import subprocess
|
6 |
|
7 |
import gradio as gr
|
|
|
117 |
try:
|
118 |
download_url = data['downloadUrl']
|
119 |
filename = dl_path.split('/')[-1]
|
120 |
+
if file_exists(
|
121 |
+
repo_id = user_repo_id,
|
122 |
+
filename = dl_path,
|
123 |
+
token = oauth_token
|
124 |
+
):
|
125 |
+
gr.Info(f"Skipping {filename}, folder exists {dl_path}")
|
126 |
+
continue
|
127 |
gr.Info(f"Downloading {filename} ({current_file}/{total_files})")
|
128 |
download_file(download_url, dl_path, folder, api_key)
|
129 |
# Upload the model and card
|