File size: 1,775 Bytes
6b5b33d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from argparse import ArgumentParser
from huggingface_hub import HfApi


def upload_videos(api, upload_dir):
    api.upload_folder(
        folder_path=upload_dir,
        repo_id="zirui-wang/survey-videos",
        repo_type="dataset",
    )


def delete_response(api):
    api.delete_folder("response", "zirui-wang/survey-videos", repo_type="dataset")


def delete_optional_feedback(api):
    api.delete_folder("optional_feedback", "zirui-wang/survey-videos", repo_type="dataset")


def main():
    parser = ArgumentParser()
    parser.add_argument(
        "--upload_dir",
        type=str,
        default="~/projects/mview/storage/data/video_diffusion/text-to-video-debug-anonymised",
    )
    parser.add_argument("--upload_videos", type=eval, default=False, choices=[True, False])
    parser.add_argument("--delete_response", type=eval, default=False, choices=[True, False])
    parser.add_argument(
        "--delete_optional_feedback", type=eval, default=False, choices=[True, False]
    )
    args = parser.parse_args()

    api = HfApi()
    if args.upload_videos:
        upload_videos(api, args.upload_dir)

    if args.delete_response:
        answer = input("Are you sure you want to delete the response folder? (y/n)")
        if answer == "y":
            try:
                delete_response(api)
            except Exception as e:
                print(e)

    if args.delete_optional_feedback:
        answer = input("Are you sure you want to delete the optional_feedback folder? (y/n)")
        if answer == "y":
            try:
                delete_optional_feedback(api)
            except Exception as e:
                print(e)

    api.super_squash_history("zirui-wang/survey-videos", repo_type="dataset")


if __name__ == "__main__":
    main()