pragnakalp commited on
Commit
1625f2c
·
1 Parent(s): a2724b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -43,6 +43,7 @@ def calculate(image_in, audio_in):
43
  image = Image.open(image_in)
44
  image = pad_image(image)
45
  image.save("image.png")
 
46
  return audio_in
47
  pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
48
  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)
@@ -54,6 +55,7 @@ def calculate(image_in, audio_in):
54
 
55
  def one_shot(image,input_text,gender):
56
  if gender == 'Female' or gender == 'female':
 
57
  tts = gTTS(input_text)
58
  with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as f:
59
  tts.write_to_fp(f)
 
43
  image = Image.open(image_in)
44
  image = pad_image(image)
45
  image.save("image.png")
46
+ print("Inside calculate")
47
  return audio_in
48
  pocketsphinx_run = subprocess.run(['pocketsphinx', '-phone_align', 'yes', 'single', '/content/audio.wav'], check=True, capture_output=True)
49
  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)
 
55
 
56
  def one_shot(image,input_text,gender):
57
  if gender == 'Female' or gender == 'female':
58
+ print(gender,input_text)
59
  tts = gTTS(input_text)
60
  with tempfile.NamedTemporaryFile(suffix='.mp3', delete=False) as f:
61
  tts.write_to_fp(f)