davanstrien HF staff commited on
Commit
49cc045
1 Parent(s): 9216cbb

Fix OAuth token parameter in

Browse files

upload_directory_to_hf function

Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -26,12 +26,12 @@ clone_into_temp_dir("https://github.com/chen-zichen/XplainLLM_dataset/")
26
  def upload_directory_to_hf(
27
  repo_id: str,
28
  directory: str,
29
- oauth_token: gr.OAuthToken,
30
  ):
31
  private = False
32
  url = create_repo(
33
  repo_id,
34
- token=oauth_token.token,
35
  exist_ok=True,
36
  repo_type="dataset",
37
  private=private,
@@ -42,7 +42,7 @@ def upload_directory_to_hf(
42
  path_in_repo="data",
43
  repo_id=repo_id,
44
  repo_type="dataset",
45
- token=oauth_token.token,
46
  commit_message="Migrated from GitHub",
47
  ignore_patterns=[
48
  "*.git*",
@@ -57,6 +57,7 @@ def push_to_hf(
57
  source_github_repository,
58
  destination_hf_hub_repository,
59
  subdirectory,
 
60
  ):
61
  gr.Info("Cloning source GitHub repository...")
62
  repo, temporary_directory = clone_into_temp_dir(source_github_repository)
@@ -69,6 +70,7 @@ def push_to_hf(
69
  upload_directory_to_hf(
70
  repo_id=destination_hf_hub_repository,
71
  directory=src_directory,
 
72
  )
73
  gr.Info("Syncing with Hugging Face Hub...Done")
74
  temporary_directory.cleanup()
 
26
  def upload_directory_to_hf(
27
  repo_id: str,
28
  directory: str,
29
+ oauth_token: str,
30
  ):
31
  private = False
32
  url = create_repo(
33
  repo_id,
34
+ token=oauth_token,
35
  exist_ok=True,
36
  repo_type="dataset",
37
  private=private,
 
42
  path_in_repo="data",
43
  repo_id=repo_id,
44
  repo_type="dataset",
45
+ token=oauth_token,
46
  commit_message="Migrated from GitHub",
47
  ignore_patterns=[
48
  "*.git*",
 
57
  source_github_repository,
58
  destination_hf_hub_repository,
59
  subdirectory,
60
+ oauth_token: gr.OAuthToken,
61
  ):
62
  gr.Info("Cloning source GitHub repository...")
63
  repo, temporary_directory = clone_into_temp_dir(source_github_repository)
 
70
  upload_directory_to_hf(
71
  repo_id=destination_hf_hub_repository,
72
  directory=src_directory,
73
+ oauth_token=oauth_token.token,
74
  )
75
  gr.Info("Syncing with Hugging Face Hub...Done")
76
  temporary_directory.cleanup()