File size: 1,338 Bytes
f5aa40c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Simple test script to push a single sample row to the HF dataset configured by
HF_TOKEN and HF_DATASET_ID environment variables.

This script is intentionally conservative: it will not modify any code and will only
attempt to push when both env vars are present. Run it locally after setting the vars.
"""
import os
import json

try:
    from app import save_responses_to_hf
except Exception as e:
    print("Failed to import save_responses_to_hf from app.py:", e)
    raise


def main():
    token = os.environ.get("HF_TOKEN")
    repo = os.environ.get("HF_DATASET_ID")
    if not token or not repo:
        print("HF_TOKEN and HF_DATASET_ID must be set in the environment. Exiting.")
        return

    row = {
        "timestamp": "2025-10-29T00:00:00Z",
        "sample": "example.wav",
        "system_path": "system-outputs/system_a/example.wav",
        "annotator": "tester",
        "session_id": "",
        "user_email": "",
        "clarity": 5,
        "accent": 5,
        "tone": 5,
        "voice_quality": 5,
        "customization": 5,
        "comfort": 5,
        "comment": "test push",
    }

    print("Attempting to push a single test row to:", repo)
    result = save_responses_to_hf([row], repo_id=repo, token=token)
    print("Result:", json.dumps(result, indent=2))


if __name__ == "__main__":
    main()