datnth1709 commited on
Commit
2fcacda
·
1 Parent(s): 15dadb3

update speech2text module

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -54,6 +54,7 @@ def speech_file_to_array_fn(path, max_seconds=10):
54
  batch["speech"] = speech_array.numpy()
55
  batch["sampling_rate"] = 16000
56
  return batch
 
57
  # tokenize
58
  def speech2text(audio):
59
  # read in sound file
@@ -109,7 +110,7 @@ with gr.Blocks() as demo:
109
  with gr.TabItem("Speech2text and translation"):
110
  with gr.Row():
111
  with gr.Column():
112
- audio = gr.Audio(source="microphone", label="Input Audio", type="filepath")
113
  translate_button = gr.Button(value="Translate To English")
114
  with gr.Column():
115
  english2 = gr.Textbox(label="English Text")
 
54
  batch["speech"] = speech_array.numpy()
55
  batch["sampling_rate"] = 16000
56
  return batch
57
+
58
  # tokenize
59
  def speech2text(audio):
60
  # read in sound file
 
110
  with gr.TabItem("Speech2text and translation"):
111
  with gr.Row():
112
  with gr.Column():
113
+ audio = gr.Audio(source="microphone", label="Input Audio", type="file", streaming=False)
114
  translate_button = gr.Button(value="Translate To English")
115
  with gr.Column():
116
  english2 = gr.Textbox(label="English Text")