Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import os
|
|
11 |
import time
|
12 |
|
13 |
#Loading the model and the tokenizer
|
14 |
-
|
15 |
#model_name = "unilux/wav2vec-xls-r-Luxembourgish20-with-LM"
|
16 |
#model_name = "unilux/wav2vec-xlsr-300m-Luxembourgish-with-LM"
|
17 |
|
@@ -26,7 +26,7 @@ model_name = "pgilles/whisper-large-v2-lb_cased_01"
|
|
26 |
#processor = WhisperProcessor.from_pretrained(model_name)
|
27 |
|
28 |
#p = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer, feature_extractor=processor.feature_extractor, decoder=processor.decoder, use_auth_token=token_key)
|
29 |
-
p = pipeline("automatic-speech-recognition", model=model_name, device=0)
|
30 |
|
31 |
#p = pipeline("automatic-speech-recognition", model=model_name, use_auth_token = token_key)
|
32 |
#p = pipeline("automatic-speech-recognition", model=model_name, use_auth_token = True)
|
@@ -41,8 +41,8 @@ def load_data(input_file):
|
|
41 |
sampling_rate = 16_000
|
42 |
#read the file
|
43 |
speech, sample_rate = librosa.load(input_file, sr=sampling_rate, mono=True)
|
44 |
-
speech = librosa.effects.trim(speech, top_db= 10)
|
45 |
-
return speech
|
46 |
|
47 |
def asr_pipe(input_file):
|
48 |
load_data(input_file)
|
|
|
11 |
import time
|
12 |
|
13 |
#Loading the model and the tokenizer
|
14 |
+
token_key = os.environ.get("HUGGING_FACE_HUB_TOKEN")
|
15 |
#model_name = "unilux/wav2vec-xls-r-Luxembourgish20-with-LM"
|
16 |
#model_name = "unilux/wav2vec-xlsr-300m-Luxembourgish-with-LM"
|
17 |
|
|
|
26 |
#processor = WhisperProcessor.from_pretrained(model_name)
|
27 |
|
28 |
#p = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer, feature_extractor=processor.feature_extractor, decoder=processor.decoder, use_auth_token=token_key)
|
29 |
+
p = pipeline("automatic-speech-recognition", model=model_name, device=0, use_auth_token=token_key)
|
30 |
|
31 |
#p = pipeline("automatic-speech-recognition", model=model_name, use_auth_token = token_key)
|
32 |
#p = pipeline("automatic-speech-recognition", model=model_name, use_auth_token = True)
|
|
|
41 |
sampling_rate = 16_000
|
42 |
#read the file
|
43 |
speech, sample_rate = librosa.load(input_file, sr=sampling_rate, mono=True)
|
44 |
+
#speech = librosa.effects.trim(speech, top_db= 10)
|
45 |
+
return speech
|
46 |
|
47 |
def asr_pipe(input_file):
|
48 |
load_data(input_file)
|