Commit
•
fe4f066
1
Parent(s):
a3f5584
quick fixes
Browse files
app.py
CHANGED
@@ -3,7 +3,6 @@ import math
|
|
3 |
import os
|
4 |
import tempfile
|
5 |
import time
|
6 |
-
from multiprocessing import Pool
|
7 |
|
8 |
import gradio as gr
|
9 |
import jax.numpy as jnp
|
@@ -78,7 +77,6 @@ if __name__ == "__main__":
|
|
78 |
chunk_len = round(CHUNK_LENGTH_S * pipeline.feature_extractor.sampling_rate)
|
79 |
stride_left = stride_right = round(stride_length_s * pipeline.feature_extractor.sampling_rate)
|
80 |
step = chunk_len - stride_left - stride_right
|
81 |
-
pool = Pool(NUM_PROC)
|
82 |
|
83 |
# do a pre-compile step so that the first user to use the demo isn't hit with a long transcription time
|
84 |
logger.info("compiling forward call...")
|
@@ -102,11 +100,6 @@ if __name__ == "__main__":
|
|
102 |
) # Gradio progress bar not compatible with generator, see https://github.com/gradio-app/gradio/issues/3841
|
103 |
|
104 |
dataloader = pipeline.preprocess_batch(inputs, chunk_length_s=CHUNK_LENGTH_S, batch_size=BATCH_SIZE)
|
105 |
-
progress(0, desc="Pre-processing audio file...")
|
106 |
-
logger.info("pre-processing audio file...")
|
107 |
-
dataloader = pool.map(identity, dataloader)
|
108 |
-
logger.info("done post-processing")
|
109 |
-
|
110 |
model_outputs = []
|
111 |
start_time = time.time()
|
112 |
logger.info("transcribing...")
|
@@ -207,7 +200,7 @@ if __name__ == "__main__":
|
|
207 |
microphone_chunked = gr.Interface(
|
208 |
fn=transcribe_chunked_audio,
|
209 |
inputs=[
|
210 |
-
gr.Audio(
|
211 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
212 |
gr.Checkbox(value=False, label="Return timestamps"),
|
213 |
],
|
@@ -224,7 +217,7 @@ if __name__ == "__main__":
|
|
224 |
audio_chunked = gr.Interface(
|
225 |
fn=transcribe_chunked_audio,
|
226 |
inputs=[
|
227 |
-
gr.Audio(
|
228 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
229 |
gr.Checkbox(value=False, label="Return timestamps"),
|
230 |
],
|
|
|
3 |
import os
|
4 |
import tempfile
|
5 |
import time
|
|
|
6 |
|
7 |
import gradio as gr
|
8 |
import jax.numpy as jnp
|
|
|
77 |
chunk_len = round(CHUNK_LENGTH_S * pipeline.feature_extractor.sampling_rate)
|
78 |
stride_left = stride_right = round(stride_length_s * pipeline.feature_extractor.sampling_rate)
|
79 |
step = chunk_len - stride_left - stride_right
|
|
|
80 |
|
81 |
# do a pre-compile step so that the first user to use the demo isn't hit with a long transcription time
|
82 |
logger.info("compiling forward call...")
|
|
|
100 |
) # Gradio progress bar not compatible with generator, see https://github.com/gradio-app/gradio/issues/3841
|
101 |
|
102 |
dataloader = pipeline.preprocess_batch(inputs, chunk_length_s=CHUNK_LENGTH_S, batch_size=BATCH_SIZE)
|
|
|
|
|
|
|
|
|
|
|
103 |
model_outputs = []
|
104 |
start_time = time.time()
|
105 |
logger.info("transcribing...")
|
|
|
200 |
microphone_chunked = gr.Interface(
|
201 |
fn=transcribe_chunked_audio,
|
202 |
inputs=[
|
203 |
+
gr.Audio(sources=["microphone"], type="filepath"),
|
204 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
205 |
gr.Checkbox(value=False, label="Return timestamps"),
|
206 |
],
|
|
|
217 |
audio_chunked = gr.Interface(
|
218 |
fn=transcribe_chunked_audio,
|
219 |
inputs=[
|
220 |
+
gr.Audio(sources=["upload"], label="Audio file", type="filepath"),
|
221 |
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
222 |
gr.Checkbox(value=False, label="Return timestamps"),
|
223 |
],
|