Commit
·
f44db21
1
Parent(s):
9d10a58
Update app.py
Browse files
app.py
CHANGED
@@ -156,7 +156,8 @@ def one_shot_talking(image_in,audio_in):
|
|
156 |
image = Image.open(image_in)
|
157 |
image = pad_image(image)
|
158 |
image.save("/content/image_pre.png")
|
159 |
-
|
|
|
160 |
pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
|
161 |
jq_run = subprocess.run(['jq', '[.w[]|{word: (.t | ascii_upcase | sub("<S>"; "sil") | sub("<SIL>"; "sil") | sub("\\\(2\\\)"; "") | sub("\\\(3\\\)"; "") | sub("\\\(4\\\)"; "") | sub("\\\[SPEECH\\\]"; "SIL") | sub("\\\[NOISE\\\]"; "SIL")), phones: [.w[]|{ph: .t | sub("\\\+SPN\\\+"; "SIL") | sub("\\\+NSN\\\+"; "SIL"), bg: (.b*100)|floor, ed: (.b*100+.d*100)|floor}]}]'], input=pocketsphinx_run.stdout, capture_output=True)
|
162 |
with open("test.json", "w") as f:
|
@@ -164,7 +165,7 @@ def one_shot_talking(image_in,audio_in):
|
|
164 |
|
165 |
os.system(f"cd /content/one-shot-talking-face && python3 -B test_script.py --img_path /content/image_pre.png --audio_path /content/audio.wav --phoneme_path /content/test.json --save_dir /content/train")
|
166 |
|
167 |
-
|
168 |
#Video Quality Improvement
|
169 |
|
170 |
#1. Extract the frames from the video file using PyVideoFramesExtractor
|
|
|
156 |
image = Image.open(image_in)
|
157 |
image = pad_image(image)
|
158 |
image.save("/content/image_pre.png")
|
159 |
+
return "/content/audio.wav"
|
160 |
+
exit()
|
161 |
pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
|
162 |
jq_run = subprocess.run(['jq', '[.w[]|{word: (.t | ascii_upcase | sub("<S>"; "sil") | sub("<SIL>"; "sil") | sub("\\\(2\\\)"; "") | sub("\\\(3\\\)"; "") | sub("\\\(4\\\)"; "") | sub("\\\[SPEECH\\\]"; "SIL") | sub("\\\[NOISE\\\]"; "SIL")), phones: [.w[]|{ph: .t | sub("\\\+SPN\\\+"; "SIL") | sub("\\\+NSN\\\+"; "SIL"), bg: (.b*100)|floor, ed: (.b*100+.d*100)|floor}]}]'], input=pocketsphinx_run.stdout, capture_output=True)
|
163 |
with open("test.json", "w") as f:
|
|
|
165 |
|
166 |
os.system(f"cd /content/one-shot-talking-face && python3 -B test_script.py --img_path /content/image_pre.png --audio_path /content/audio.wav --phoneme_path /content/test.json --save_dir /content/train")
|
167 |
|
168 |
+
exit()
|
169 |
#Video Quality Improvement
|
170 |
|
171 |
#1. Extract the frames from the video file using PyVideoFramesExtractor
|