|
import os |
|
from git import Repo |
|
|
|
|
|
github_repo_url = "https://github.com/Vignesh2064/tt-oilwells-demo-model.git" |
|
hf_username = "Imvignesh" |
|
hf_repo_name = "tt-oilwells-demo-model" |
|
hf_token = os.getenv('HF_TOKEN') |
|
|
|
def main(): |
|
|
|
repo_dir = "tt-oilwells-demo-model" |
|
Repo.clone_from(github_repo_url, repo_dir) |
|
os.chdir(repo_dir) |
|
|
|
|
|
hf_remote_url = f"https://{hf_username}:{hf_token}@huggingface.co/{hf_username}/{hf_repo_name}.git" |
|
repo = Repo(".") |
|
|
|
try: |
|
hf_remote = repo.create_remote("hf_origin", hf_remote_url) |
|
except: |
|
hf_remote = repo.remote("hf_origin") |
|
hf_remote.set_url(hf_remote_url) |
|
|
|
|
|
repo.git.add(".") |
|
repo.index.commit("Initial commit from GitHub repository") |
|
repo.git.push("--set-upstream", "hf_origin", "HEAD:main") |
|
|
|
print("Files pushed successfully to Hugging Face repository.") |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|