Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -72,20 +72,19 @@ def upload_gitRepository():
|
|
72 |
print("Existing files:", existing_files) # Debug print statement
|
73 |
target_path = f"{REPOSITORY_DIRECTORY}/{filename}"
|
74 |
print("Constructed target path:", target_path) # Debug print statement
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
# print(f"Repository '{project_id}' downloaded and uploaded to Hugging Face space '{HF_SPACE_NAME}' in folder '{REPOSITORY_DIRECTORY}' with original file name '{filename}'")
|
89 |
|
90 |
def process_directory(directory):
|
91 |
all_texts = []
|
|
|
72 |
print("Existing files:", existing_files) # Debug print statement
|
73 |
target_path = f"{REPOSITORY_DIRECTORY}/{filename}"
|
74 |
print("Constructed target path:", target_path) # Debug print statement
|
75 |
+
|
76 |
+
|
77 |
+
if target_path in existing_files:
|
78 |
+
print(f"File '{target_path}' already exists in the repository. Skipping upload...")
|
79 |
+
else:
|
80 |
+
# Upload the ZIP file to the new folder in the Hugging Face space repository
|
81 |
+
api.upload_file(
|
82 |
+
path_or_fileobj=archive_bytes,
|
83 |
+
path_in_repo=target_path,
|
84 |
+
repo_id=HF_SPACE_NAME,
|
85 |
+
repo_type='space'
|
86 |
+
)
|
87 |
+
#print(f"Repository '{project_id}' downloaded and uploaded to Hugging Face space '{HF_SPACE_NAME}' in folder '{REPOSITORY_DIRECTORY}' with original file name '{filename}'")
|
|
|
88 |
|
89 |
def process_directory(directory):
|
90 |
all_texts = []
|