pragnakalp commited on
Commit
5d58ab8
·
1 Parent(s): 81cf309

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -44,7 +44,16 @@ def one_shot(image,input_text,gender):
44
  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)
45
  with open("test.json", "w") as f:
46
  f.write(jq_run.stdout.decode('utf-8').strip())
 
 
 
 
 
 
47
 
 
 
 
48
  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")
49
 
50
  except Exception as e:
@@ -94,7 +103,7 @@ def run():
94
  # audio_in = gr.Audio(show_label=False, type='filepath')
95
  input_text=gr.Textbox(lines=3, value="Hello How are you?", label="Input Text")
96
  gender = gr.Radio(["Female","Male"],value="Female",label="Gender")
97
- video_out = gr.Video(label="output")
98
  # video_out = gr.Video(show_label=False)
99
  with gr.Row().style(equal_height=True):
100
  btn = gr.Button("Generate")
 
44
  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)
45
  with open("test.json", "w") as f:
46
  f.write(jq_run.stdout.decode('utf-8').strip())
47
+ import json
48
+
49
+ with open('user.json') as user_file:
50
+ file_contents = user_file.read()
51
+
52
+
53
 
54
+ parsed_json = json.loads(file_contents)
55
+ return parsed_json
56
+ exit()
57
  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")
58
 
59
  except Exception as e:
 
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.Textbox(label="output")
107
  # video_out = gr.Video(show_label=False)
108
  with gr.Row().style(equal_height=True):
109
  btn = gr.Button("Generate")