Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
9eeb99a
1
Parent(s):
3879714
warmup
Browse files
app.py
CHANGED
@@ -55,7 +55,6 @@ distil_pipe = pipeline(
|
|
55 |
)
|
56 |
distil_pipe_forward = distil_pipe._forward
|
57 |
|
58 |
-
|
59 |
def warmup():
|
60 |
inputs = np.random.randn(30 * pipe.feature_extractor.sampling_rate)
|
61 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
@@ -64,7 +63,6 @@ def warmup():
|
|
64 |
_ = pipe(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
65 |
_ = distil_pipe(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
66 |
|
67 |
-
|
68 |
@spaces.GPU
|
69 |
def transcribe(inputs):
|
70 |
# warmup the gpu
|
@@ -81,9 +79,6 @@ def transcribe(inputs):
|
|
81 |
inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
|
82 |
audio_length_mins = len(inputs) / pipe.feature_extractor.sampling_rate / 60
|
83 |
|
84 |
-
print(type(inputs))
|
85 |
-
print(inputs.shape)
|
86 |
-
|
87 |
if audio_length_mins > MAX_AUDIO_MINS:
|
88 |
raise gr.Error(
|
89 |
f"To ensure fair usage of the Space, the maximum audio length permitted is {MAX_AUDIO_MINS} minutes."
|
@@ -117,7 +112,6 @@ def transcribe(inputs):
|
|
117 |
|
118 |
yield distil_text, distil_runtime, text, runtime
|
119 |
|
120 |
-
|
121 |
if __name__ == "__main__":
|
122 |
with gr.Blocks() as demo:
|
123 |
gr.HTML(
|
|
|
55 |
)
|
56 |
distil_pipe_forward = distil_pipe._forward
|
57 |
|
|
|
58 |
def warmup():
|
59 |
inputs = np.random.randn(30 * pipe.feature_extractor.sampling_rate)
|
60 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
|
|
63 |
_ = pipe(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
64 |
_ = distil_pipe(inputs.copy(), batch_size=BATCH_SIZE)["text"]
|
65 |
|
|
|
66 |
@spaces.GPU
|
67 |
def transcribe(inputs):
|
68 |
# warmup the gpu
|
|
|
79 |
inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
|
80 |
audio_length_mins = len(inputs) / pipe.feature_extractor.sampling_rate / 60
|
81 |
|
|
|
|
|
|
|
82 |
if audio_length_mins > MAX_AUDIO_MINS:
|
83 |
raise gr.Error(
|
84 |
f"To ensure fair usage of the Space, the maximum audio length permitted is {MAX_AUDIO_MINS} minutes."
|
|
|
112 |
|
113 |
yield distil_text, distil_runtime, text, runtime
|
114 |
|
|
|
115 |
if __name__ == "__main__":
|
116 |
with gr.Blocks() as demo:
|
117 |
gr.HTML(
|