tortoise-tts/tortoise/is_this_from_tortoise.py

14 lines
546 B
Python
Raw Normal View History

2022-04-26 16:24:03 +00:00
import argparse
from api import classify_audio_clip
from tortoise.utils.audio import load_audio
2022-04-26 16:24:03 +00:00
if __name__ == '__main__':
parser = argparse.ArgumentParser()
2022-05-03 00:00:57 +00:00
parser.add_argument('--clip', type=str, help='Path to an audio clip to classify.', default="../examples/favorite_riding_hood.mp3")
2022-04-26 16:24:03 +00:00
args = parser.parse_args()
clip = load_audio(args.clip, 24000)
clip = clip[:, :220000]
prob = classify_audio_clip(clip)
print(f"This classifier thinks there is a {prob*100}% chance that this clip was generated from Tortoise.")