Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,8 +13,11 @@ token_key = os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
|
13 |
model_name = "unilux/whisper-large-v2-lb_cased_01"
|
14 |
|
15 |
#p = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer, feature_extractor=processor.feature_extractor, decoder=processor.decoder, use_auth_token=token_key)
|
16 |
-
|
17 |
|
|
|
|
|
|
|
18 |
def load_data(input_file):
|
19 |
|
20 |
""" Function for resampling to ensure that the speech input is sampled at 16KHz.
|
@@ -27,7 +30,7 @@ def load_data(input_file):
|
|
27 |
|
28 |
def asr_pipe(input_file, input_file_microphone, chunks):
|
29 |
input_file = input_file_microphone if input_file_microphone else input_file
|
30 |
-
transcription =
|
31 |
return transcription
|
32 |
|
33 |
inputs = [gr.inputs.Audio(source="upload", type='filepath', label="Eng Audio-Datei eroplueden...", optional = True),
|
|
|
13 |
model_name = "unilux/whisper-large-v2-lb_cased_01"
|
14 |
|
15 |
#p = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer, feature_extractor=processor.feature_extractor, decoder=processor.decoder, use_auth_token=token_key)
|
16 |
+
pipe = pipeline("automatic-speech-recognition", model=model_name, device=0, use_auth_token=token_key)
|
17 |
|
18 |
+
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(
|
19 |
+
language=lang, task="transcribe"
|
20 |
+
|
21 |
def load_data(input_file):
|
22 |
|
23 |
""" Function for resampling to ensure that the speech input is sampled at 16KHz.
|
|
|
30 |
|
31 |
def asr_pipe(input_file, input_file_microphone, chunks):
|
32 |
input_file = input_file_microphone if input_file_microphone else input_file
|
33 |
+
transcription = pipe(input_file, chunk_length_s= 30)["text"]
|
34 |
return transcription
|
35 |
|
36 |
inputs = [gr.inputs.Audio(source="upload", type='filepath', label="Eng Audio-Datei eroplueden...", optional = True),
|