Spaces:
Build error
Build error
from huggingface_hub import HfApi | |
import os | |
api = HfApi() | |
space_id = "Kurian07/Ultimate_llm_rag" | |
folder_path = "C:/Users/kuria/OneDrive/Desktop/llm/chatPDF-RAG/embeddingModel" | |
for root, _, files in os.walk(folder_path): | |
for file in files: | |
file_path = os.path.join(root, file) | |
relative_path = os.path.relpath(file_path, folder_path) # Path inside the repo | |
try: | |
# Attempt to upload each file | |
api.upload_file( | |
path_or_fileobj=file_path, | |
path_in_repo=relative_path, | |
repo_id=space_id, | |
repo_type="space" | |
) | |
print(f"Uploaded {relative_path} to Hugging Face Space.") | |
except Exception as e: | |
print(f"Failed to upload {relative_path}: {e}") | |