bupa1018 commited on
Commit
f79e678
·
1 Parent(s): f435cf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -67,25 +67,31 @@ def upload_gitRepository():
67
  else:
68
  filename = 'archive.zip' # Fallback to a default name if not found
69
 
 
 
70
  # Check if the file already exists in the repository
71
  existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
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("Uploading File to directory")
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 = []
 
67
  else:
68
  filename = 'archive.zip' # Fallback to a default name if not found
69
 
70
+
71
+
72
  # Check if the file already exists in the repository
73
  existing_files = api.list_repo_files(repo_id=HF_SPACE_NAME, repo_type='space')
 
74
  target_path = f"{REPOSITORY_DIRECTORY}/{filename}"
 
 
75
 
76
+ print(f"Target Path: '{target_path}'")
77
+ print(f"Existing Files: {[repr(file) for file in existing_files]}")
78
+
79
  if target_path in existing_files:
80
  print(f"File '{target_path}' already exists in the repository. Skipping upload...")
81
  else:
82
  # Upload the ZIP file to the new folder in the Hugging Face space repository
83
+ print("Uploading File to directory:")
84
+ print(f"Archive Bytes: {repr(archive_bytes.getvalue())[:100]}") # Show a preview of bytes
85
+ print(f"Target Path in Repo: '{target_path}'")
86
+
87
+ api.upload_file(
88
+ path_or_fileobj=archive_bytes,
89
+ path_in_repo=target_path,
90
+ repo_id=HF_SPACE_NAME,
91
+ repo_type='space'
92
+ )
93
+ print("Upload complete")
94
+
95
 
96
  def process_directory(directory):
97
  all_texts = []