Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -48,10 +48,10 @@ HEADER_INFO = """
|
|
48 |
# WEB APP ✨| Norwegian WHISPER Model
|
49 |
Switch Work [Transkribering av lydfiler til norsk skrift]
|
50 |
""".strip()
|
51 |
-
LOGO = "https://huggingface.co/spaces/camparchimedes/
|
52 |
SIDEBAR_INFO = f"""
|
53 |
<div align=center>
|
54 |
-
<img src="{LOGO}" width
|
55 |
|
56 |
warnings.filterwarnings("ignore")
|
57 |
|
@@ -78,13 +78,16 @@ pipe = pipeline(
|
|
78 |
device=device,
|
79 |
)
|
80 |
|
81 |
-
def transcribe_audio(audio_file, batch_size=
|
82 |
if audio_file.endswith(".m4a"):
|
83 |
audio_file = convert_to_wav(audio_file)
|
84 |
|
85 |
start_time = time.time()
|
86 |
|
87 |
-
outputs = pipe(audio_file, batch_size=batch_size, return_timestamps=False, generate_kwargs={'
|
|
|
|
|
|
|
88 |
text = outputs["text"]
|
89 |
|
90 |
end_time = time.time()
|
|
|
48 |
# WEB APP ✨| Norwegian WHISPER Model
|
49 |
Switch Work [Transkribering av lydfiler til norsk skrift]
|
50 |
""".strip()
|
51 |
+
LOGO = "https://huggingface.co/spaces/camparchimedes/transcription_app/resolve/main/pic09w9678yhit.png"
|
52 |
SIDEBAR_INFO = f"""
|
53 |
<div align=center>
|
54 |
+
<img src="{LOGO}" style="width: 100%; height: auto;"/>"""
|
55 |
|
56 |
warnings.filterwarnings("ignore")
|
57 |
|
|
|
78 |
device=device,
|
79 |
)
|
80 |
|
81 |
+
def transcribe_audio(audio_file, batch_size=16):
|
82 |
if audio_file.endswith(".m4a"):
|
83 |
audio_file = convert_to_wav(audio_file)
|
84 |
|
85 |
start_time = time.time()
|
86 |
|
87 |
+
outputs = pipe(audio_file, batch_size=batch_size, return_timestamps=False, generate_kwargs={'task': 'transcribe', 'language': 'no'}) # skip_special_tokens=True
|
88 |
+
#options = dict(language=selected_source_lang, beam_size=3, best_of=3)
|
89 |
+
#transcribe_options = dict(task="transcribe", **options)
|
90 |
+
#result = model.transcribe(file, **transcribe_options)
|
91 |
text = outputs["text"]
|
92 |
|
93 |
end_time = time.time()
|