multimodalart HF staff commited on
Commit
6a50ac3
·
1 Parent(s): 31061ea

Update script.py

Browse files
Files changed (1) hide show
  1. script.py +5 -2
script.py CHANGED
@@ -55,9 +55,13 @@ def do_inference(dataset_name, output_dir, num_tokens):
55
  }
56
  }
57
  widget_content.append(card_dict)
 
 
 
58
  with open(f'{output_dir}/README.md', 'r') as file:
59
  readme_content = file.read()
60
-
 
61
  card = RepoCard(readme_content)
62
  card.data["widget"] = widget_content
63
  card.save(f'{output_dir}/README.md')
@@ -68,7 +72,6 @@ def do_inference(dataset_name, output_dir, num_tokens):
68
  api = HfApi()
69
  username = api.whoami()["name"]
70
  print("Starting upload...")
71
- api.create_repo(f"{username}/{output_dir}", exist_ok=True)
72
  api.upload_folder(
73
  folder_path=output_dir,
74
  repo_id=f"{username}/{output_dir}",
 
55
  }
56
  }
57
  widget_content.append(card_dict)
58
+
59
+ repo_id = api.create_repo(f"{username}/{output_dir}", exist_ok=True).repo_id
60
+
61
  with open(f'{output_dir}/README.md', 'r') as file:
62
  readme_content = file.read()
63
+ readme_content = readme_content.replace(f'{output_dir}', f'{username}/{output_dir}')
64
+
65
  card = RepoCard(readme_content)
66
  card.data["widget"] = widget_content
67
  card.save(f'{output_dir}/README.md')
 
72
  api = HfApi()
73
  username = api.whoami()["name"]
74
  print("Starting upload...")
 
75
  api.upload_folder(
76
  folder_path=output_dir,
77
  repo_id=f"{username}/{output_dir}",