tts-evaluation / hf_push_test.py
kathiasi's picture
Added explanations to each evaluation point, added a functionality to save responses to a private HF dataset
f5aa40c verified
"""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()