zhtest.py 785 B

123456789101112131415161718192021
  1. import zhtts
  2. import celery
  3. import string
  4. import random
  5. # export CUDA_VISIBLE_DEVICES=0 ; python3.7 train.py -content /tmp/demo.wav -style input/girl52.wav
  6. #py -3.7 save_mel.py --face a1.mp4 --audio eng1.mp3 --checkpoint_path wav2lip_gan.pth
  7. #export CUDA_VISIBLE_DEVICES=0 ; python3.7 save_mel.py --face nina.mp4 --audio /tmp/demo.wav --checkpoint_path wav2lip_gan.pth
  8. from celery import Celery
  9. app = Celery('tasks', broker='redis://db.ptt.cx/0')
  10. @app.task
  11. def to_wav(txt):
  12. letters = string.digits
  13. rstr= ''.join(random.choice(letters) for i in range(10))
  14. #text2mel_name="TACOTRON"
  15. tts = zhtts.TTS() # use fastspeech2 by default
  16. #tts = zhtts.TTS(text2mel_name="TACOTRON") # use fastspeech2 by default
  17. tts.text2wav(txt, "/var/wav/"+rstr+".wav")
  18. return rstr