Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -111,11 +111,13 @@ def transcribe_audio(audio_file, chunk_length_s=30):
|
|
111 |
# Create attention mask
|
112 |
attention_mask = torch.ones(inputs.input_features.shape[:2], dtype=torch.long, device=device)
|
113 |
|
114 |
-
#
|
115 |
-
input_ids = inputs['input_ids']
|
|
|
|
|
116 |
|
117 |
# Set the attention mask to zero for padding tokens
|
118 |
-
attention_mask[
|
119 |
|
120 |
|
121 |
# ASR model inference on the chunk
|
@@ -267,8 +269,8 @@ def save_to_pdf(text, summary):
|
|
267 |
iface = gr.Blocks()
|
268 |
|
269 |
with iface:
|
270 |
-
gr.HTML('<img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/blob/main/
|
271 |
-
gr.Markdown("**Switch Work
|
272 |
|
273 |
with gr.Tabs():
|
274 |
with gr.TabItem("Transcription"):
|
|
|
111 |
# Create attention mask
|
112 |
attention_mask = torch.ones(inputs.input_features.shape[:2], dtype=torch.long, device=device)
|
113 |
|
114 |
+
# -- does not output input_ids (i.e, processor)
|
115 |
+
# input_ids = inputs['input_ids']
|
116 |
+
# attention_mask[input_ids == processor.tokenizer.pad_token_id] = 0
|
117 |
+
|
118 |
|
119 |
# Set the attention mask to zero for padding tokens
|
120 |
+
attention_mask[inputs.input_features.squeeze(0) == processor.tokenizer.pad_token_id] = 0
|
121 |
|
122 |
|
123 |
# ASR model inference on the chunk
|
|
|
269 |
iface = gr.Blocks()
|
270 |
|
271 |
with iface:
|
272 |
+
gr.HTML('<img src="https://huggingface.co/spaces/camparchimedes/ola_s-audioshop/blob/main/pic09w9678yhit.png" alt="" width="100%" height="auto"/>')
|
273 |
+
gr.Markdown("**Switch Work webapp for transkribering av lydfiler til norsk skrift. Språkmodell: NbAiLab/nb-whisper-large, Ekstra: oppsummering, pdf-download**")
|
274 |
|
275 |
with gr.Tabs():
|
276 |
with gr.TabItem("Transcription"):
|