| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- from pathlib import Path
- from typing import List, Dict, Any
- import pandas as pd
- from util import file_util
- base_dir = "/Users/zhao/Desktop/tzld/TTS"
- test_sample_csv = f"{base_dir}/test_sample.csv"
- reference_path = f"{base_dir}/audio"
- def read_test_sample(csv_file: Path) -> List[Dict[str, Any]]:
- if csv_file.exists():
- df = pd.read_csv(csv_file)
- return df.to_dict(orient="records")
- else:
- return []
- def reference_audio_download(audio_url: str, local_file_path: str):
- file_util.download_file(audio_url, local_file_path)
- def main():
- df = pd.read_csv(test_sample_csv)
- speaker_counts = df["speaker"].value_counts()
- print(f"{'speaker':<30} count")
- print("-" * 38)
- for speaker, count in speaker_counts.items():
- print(f"{speaker:<30} {count}")
- # test_sample_list = read_test_sample(Path(test_sample_csv))
- # for item in test_sample_list:
- # speaker = item["speaker"]
- # audio_url = item["audio_url"]
- # result = item["result"]
- # txt = item["txt"]
- # reference_audio_download(audio_url, local_file_path=f"{reference_path}/{speaker}.mp3")
- if __name__ == '__main__':
- main()
|