Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
# -----------------COPY OF NEW EDITION[app.py]-----------------
|
4 |
-
|
5 |
-
# check if still the case...........??*********************************************
|
6 |
-
# "The attention mask is not set and cannot be inferred from input because pad token is same as eos token. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results."
|
7 |
-
|
8 |
-
|
9 |
import time
|
10 |
import os
|
11 |
import spaces
|
@@ -39,7 +31,7 @@ if processor.tokenizer.eos_token_id is None:
|
|
39 |
pipe = pipeline("automatic-speech-recognition", model="NbAiLabBeta/nb-whisper-large", torch_dtype=torch_dtype)
|
40 |
|
41 |
#language = "no"
|
42 |
-
task = "transcribe"
|
43 |
|
44 |
def transcribe_audio(audio_file):
|
45 |
if audio_file.endswith(".m4a"):
|
@@ -52,7 +44,7 @@ def transcribe_audio(audio_file):
|
|
52 |
audio_file,
|
53 |
chunk_length_s=30,
|
54 |
generate_kwargs={
|
55 |
-
"task": task,
|
56 |
"pad_token_id": processor.tokenizer.pad_token_id,
|
57 |
"eos_token_id": processor.tokenizer.eos_token_id
|
58 |
}
|
@@ -190,13 +182,14 @@ def text_rank_summary(text, num_paragraphs=3):
|
|
190 |
|
191 |
summary = [ranked_sentences[i][1] for i in range(num_paragraphs)] # top sentences for summary
|
192 |
return ' '.join(summary)
|
193 |
-
|
194 |
banner_html = """
|
195 |
<div style="text-align: center;">
|
196 |
-
<img src="https://huggingface.co/spaces/camparchimedes/transcription_app/
|
|
|
197 |
</div>
|
198 |
"""
|
199 |
-
# https://raw.
|
200 |
|
201 |
|
202 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import time
|
2 |
import os
|
3 |
import spaces
|
|
|
31 |
pipe = pipeline("automatic-speech-recognition", model="NbAiLabBeta/nb-whisper-large", torch_dtype=torch_dtype)
|
32 |
|
33 |
#language = "no"
|
34 |
+
# task = "transcribe"
|
35 |
|
36 |
def transcribe_audio(audio_file):
|
37 |
if audio_file.endswith(".m4a"):
|
|
|
44 |
audio_file,
|
45 |
chunk_length_s=30,
|
46 |
generate_kwargs={
|
47 |
+
# "task": task,
|
48 |
"pad_token_id": processor.tokenizer.pad_token_id,
|
49 |
"eos_token_id": processor.tokenizer.eos_token_id
|
50 |
}
|
|
|
182 |
|
183 |
summary = [ranked_sentences[i][1] for i in range(num_paragraphs)] # top sentences for summary
|
184 |
return ' '.join(summary)
|
185 |
+
|
186 |
banner_html = """
|
187 |
<div style="text-align: center;">
|
188 |
+
<img src="https://raw.huggingface.co/spaces/camparchimedes/transcription_app/blob/main/banner_trans.png
|
189 |
+
" alt="" width="100%" height="auto">
|
190 |
</div>
|
191 |
"""
|
192 |
+
# https://raw.huggingface.co/spaces/camparchimedes/transcription_app/blob/main/banner_trans.png
|
193 |
|
194 |
|
195 |
import gradio as gr
|