|
import os |
|
from huggingface_hub import HfApi |
|
|
|
|
|
api = HfApi() |
|
|
|
|
|
repo_id = "NexaAIDev/octopus-v4-gguf" |
|
repo_type = "model" |
|
|
|
|
|
existing_files = api.list_repo_files(repo_id=repo_id, repo_type=repo_type) |
|
|
|
|
|
local_directory = "./" |
|
|
|
|
|
for filename in os.listdir(local_directory): |
|
if filename.endswith(".gguf"): |
|
|
|
if filename not in existing_files: |
|
print(f"Uploading {filename}...") |
|
api.upload_file( |
|
path_or_fileobj=os.path.join(local_directory, filename), |
|
path_in_repo=filename, |
|
repo_id=repo_id, |
|
repo_type=repo_type, |
|
) |
|
print(f"Uploaded {filename}.") |
|
else: |
|
print(f"{filename} already exists in the repository.") |
|
else: |
|
print(f"{filename} is not a .gguf file.") |
|
|
|
print("Operation completed.") |
|
|