12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import celery
- import string
- import random
- import os
- # export CUDA_VISIBLE_DEVICES=0 ; python3.7 train.py -content /tmp/demo.wav -style input/girl52.wav
- #py -3.7 save_mel.py --face a1.mp4 --audio eng1.mp3 --checkpoint_path wav2lip_gan.pth
- #export CUDA_VISIBLE_DEVICES=0 ; python3.7 save_mel.py --face nina.mp4 --audio /tmp/demo.wav --checkpoint_path wav2lip_gan.pth
- from celery import Celery
- app = Celery('tasks', broker='redis://db.ptt.cx/0')
- @app.task
- def full_task(datadict):
- content=datadict['content']
- title=datadict['title']
- bg1=datadict['bg1']
- import zhtts
- tts = zhtts.TTS()
- #tts = zhtts.TTS(text2mel_name="TACOTRON") # use fastspeech2 by default
- tts.text2wav(content, "/var/wav/full.wav")
- os.chdir('/root/src/CMM_API/tests')
- os.system('python3 fonttest.py '+title)
- os.system('curl -o /var/txt/tmp.jpg '+bg1)
- os.system('convert /var/txt/tmp.jpg -resize 1050x1050 /var/txt/bg1.jpg')
- os.chdir('/home/jared/to_video')
- os.system('export CUDA_VISIBLE_DEVICES=0 ; python3.7 save_mel.py --face nina-no-ges.mp4 --audio /var/wav/full.wav --outfile /var/video/full.mp4 --checkpoint_path gan.pth')
- #text2mel_name="TACOTRON"
- os.chdir('/root/src/CMM_API/tests')
- os.system('python3 openshottest.py')
- return "ok"
- @app.task
- def to_video(fname):
- os.chdir('/home/jared/to_video')
- 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')
- #text2mel_name="TACOTRON"
- return "ok"
- @app.task
- def to_wav(txt):
- import zhtts
- letters = string.digits
- rstr= ''.join(random.choice(letters) for i in range(10))
- #text2mel_name="TACOTRON"
- tts = zhtts.TTS() # use fastspeech2 by default
- #tts = zhtts.TTS(text2mel_name="TACOTRON") # use fastspeech2 by default
- tts.text2wav(txt, "/var/wav/"+rstr+".wav")
- return rstr
|