zhtest.py 1.1 KB

123456789101112131415161718192021222324252627282930
  1. import celery
  2. import string
  3. import random
  4. import os
  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_video(fname):
  12. os.chdir('/home/jared/to_video')
  13. os.system('export CUDA_VISIBLE_DEVICES=0 ; python3.7 save_mel.py --face nina-no-ges.mp4 --audio /var/wav/'+fname+'.wav --outfile /var/video/'+fname+'.mp4 --checkpoint_path gan.pth')
  14. #text2mel_name="TACOTRON"
  15. return "ok"
  16. @app.task
  17. def to_wav(txt):
  18. import zhtts
  19. letters = string.digits
  20. rstr= ''.join(random.choice(letters) for i in range(10))
  21. #text2mel_name="TACOTRON"
  22. tts = zhtts.TTS() # use fastspeech2 by default
  23. #tts = zhtts.TTS(text2mel_name="TACOTRON") # use fastspeech2 by default
  24. tts.text2wav(txt, "/var/wav/"+rstr+".wav")
  25. return rstr