Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ processor = AutoProcessor.from_pretrained("NbAiLabBeta/nb-whisper-large")
|
|
30 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
31 |
torch_dtype = torch.float32
|
32 |
|
33 |
-
pipe = pipeline("automatic-speech-recognition", model="NbAiLabBeta/nb-whisper-large",
|
34 |
|
35 |
language = "no"
|
36 |
task = "transcribe"
|
@@ -47,7 +47,7 @@ def transcribe_audio(audio_file):
|
|
47 |
|
48 |
with torch.no_grad():
|
49 |
# CUDA within the function
|
50 |
-
with torch.cuda.device(device) if torch.cuda.is_available() else contextlib.nullcontext():
|
51 |
output = pipe(audio_file, chunk_length_s=30, generate_kwargs={"forced_decoder_ids": forced_decoder_ids})
|
52 |
|
53 |
text = output["text"]
|
@@ -185,7 +185,7 @@ def text_rank_summary(text, num_paragraphs=3):
|
|
185 |
|
186 |
banner_html = """
|
187 |
<div style="text-align: center;">
|
188 |
-
<img src="https://
|
189 |
</div>
|
190 |
"""
|
191 |
|
|
|
30 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
31 |
torch_dtype = torch.float32
|
32 |
|
33 |
+
pipe = pipeline("automatic-speech-recognition", model="NbAiLabBeta/nb-whisper-large", torch_dtype=torch_dtype)
|
34 |
|
35 |
language = "no"
|
36 |
task = "transcribe"
|
|
|
47 |
|
48 |
with torch.no_grad():
|
49 |
# CUDA within the function
|
50 |
+
# with torch.cuda.device(device) if torch.cuda.is_available() else contextlib.nullcontext():
|
51 |
output = pipe(audio_file, chunk_length_s=30, generate_kwargs={"forced_decoder_ids": forced_decoder_ids})
|
52 |
|
53 |
text = output["text"]
|
|
|
185 |
|
186 |
banner_html = """
|
187 |
<div style="text-align: center;">
|
188 |
+
<img src="https://github.com/camparchimedes/sw-llm/blob/main/annex/cooltext462376124862020.png" alt="" width="100%" height="auto">
|
189 |
</div>
|
190 |
"""
|
191 |
|