meg-huggingface commited on
Commit
3ed6477
·
1 Parent(s): 2791eb8

Adding a file to upload the runs directory somewhere

Browse files
Files changed (1) hide show
  1. upload_run_folder.py +28 -0
upload_run_folder.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import os
3
+ from huggingface_hub import HfApi
4
+
5
+ TOKEN = os.environ.get("DEBUG")
6
+ api = HfApi(token=TOKEN)
7
+
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument(
10
+ "--run_dir",
11
+ default="./runs",
12
+ type=str,
13
+ required=False,
14
+ help="Path to the runs directory.",
15
+ )
16
+ args = parser.parse_args()
17
+
18
+ print("Attempting to save the Space runs directory, %s" % args.run_dir)
19
+ try:
20
+ api.upload_folder(
21
+ folder_path=args.run_dir,
22
+ path_in_repo=args.run_dir,
23
+ repo_id="EnergyStarAI/backend_runs_directory",
24
+ repo_type="dataset",
25
+ )
26
+ except Exception as e:
27
+ print("That didn't work. Error:")
28
+ print(e)