Commit
·
e8b688a
1
Parent(s):
afddaa3
Update app.py
Browse files
app.py
CHANGED
@@ -39,16 +39,14 @@ def one_shot(image,input_text,gender):
|
|
39 |
image = Image.open(image_in)
|
40 |
image = pad_image(image)
|
41 |
image.save("/content/image_pre.png")
|
42 |
-
print("Print 2")
|
43 |
-
return "/content/image_pre.png"
|
44 |
-
exit()
|
45 |
pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
|
46 |
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)
|
47 |
with open("test.json", "w") as f:
|
48 |
f.write(jq_run.stdout.decode('utf-8').strip())
|
49 |
|
50 |
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")
|
51 |
-
|
|
|
52 |
#1. Extract the frames from the video file using PyVideoFramesExtractor
|
53 |
os.system(f"python /content/PyVideoFramesExtractor/extract.py --video=/content/train/image_pre_audio.mp4")
|
54 |
|
@@ -103,7 +101,7 @@ def run():
|
|
103 |
# audio_in = gr.Audio(show_label=False, type='filepath')
|
104 |
input_text=gr.Textbox(lines=3, value="Hello How are you?", label="Input Text")
|
105 |
gender = gr.Radio(["Female","Male"],value="Female",label="Gender")
|
106 |
-
video_out = gr.
|
107 |
# video_out = gr.Video(show_label=False)
|
108 |
with gr.Row().style(equal_height=True):
|
109 |
btn = gr.Button("Generate")
|
|
|
39 |
image = Image.open(image_in)
|
40 |
image = pad_image(image)
|
41 |
image.save("/content/image_pre.png")
|
|
|
|
|
|
|
42 |
pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
|
43 |
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)
|
44 |
with open("test.json", "w") as f:
|
45 |
f.write(jq_run.stdout.decode('utf-8').strip())
|
46 |
|
47 |
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")
|
48 |
+
return "/content/train/image_pre_audio.mp4"
|
49 |
+
exit()
|
50 |
#1. Extract the frames from the video file using PyVideoFramesExtractor
|
51 |
os.system(f"python /content/PyVideoFramesExtractor/extract.py --video=/content/train/image_pre_audio.mp4")
|
52 |
|
|
|
101 |
# audio_in = gr.Audio(show_label=False, type='filepath')
|
102 |
input_text=gr.Textbox(lines=3, value="Hello How are you?", label="Input Text")
|
103 |
gender = gr.Radio(["Female","Male"],value="Female",label="Gender")
|
104 |
+
video_out = gr.Video(label="output")
|
105 |
# video_out = gr.Video(show_label=False)
|
106 |
with gr.Row().style(equal_height=True):
|
107 |
btn = gr.Button("Generate")
|