bupa1018 commited on
Commit
63c85fb
·
1 Parent(s): 11a7693

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
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
- # if target_path in existing_files:
77
- # print(f"File '{target_path}' already exists in the repository. Skipping upload...")
78
- # continue
79
-
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
-
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 = []