Your Name 4 years ago
parent
commit
96338d0a8f
2 changed files with 29 additions and 0 deletions
  1. 12 0
      apis/main.py
  2. 17 0
      apis/to_video.py

+ 12 - 0
apis/main.py

@@ -13,6 +13,10 @@ from pydantic import BaseModel
 import rpyc
 
 
+class FName(BaseModel):
+    fname: str
+
+
 class TTS(BaseModel):
     txt: str
     num: str
@@ -22,6 +26,14 @@ class TTS(BaseModel):
 
 app = FastAPI()
 
+@app.post("/tts/audio_to_video")
+async def audio_to_video(item: FName):
+    print(item.fname)
+    
+    return {"OK": "200"}
+
+
+
 @app.post("/tts")
 async def run_tts(item: TTS):
     print(item.txt)

+ 17 - 0
apis/to_video.py

@@ -0,0 +1,17 @@
+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 to_video(fname):
+    os.chdir('/home/jared/to_video')
+    os.system('python3.7 save_mel.py --face nina-no-ges.mp4 --audio /var/wav/'+fname+'.wav --checkpoint_path gan.pth')
+    #text2mel_name="TACOTRON"
+    return "ok"