Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,8 @@ pipe_is = pipeline(model=MODEL_IS)
|
|
22 |
pipe_fo = pipeline(model=MODEL_FO)
|
23 |
|
24 |
|
25 |
-
|
26 |
-
whm_is =
|
27 |
|
28 |
|
29 |
|
@@ -46,13 +46,12 @@ def recc(audio_file,model,processor):
|
|
46 |
xcp = processor.batch_decode(pred_ids)
|
47 |
return xcp[0]
|
48 |
|
49 |
-
def whrecc(audio_file,wmodel
|
50 |
wav = readwav(audio_file)
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
return xcp
|
56 |
|
57 |
|
58 |
def recis(audio_file):
|
@@ -69,7 +68,7 @@ def recfo(audio_file):
|
|
69 |
|
70 |
|
71 |
def recwhis(audio_file):
|
72 |
-
wh_output = whrecc(audio_file,whm_is
|
73 |
return(wh_output)
|
74 |
|
75 |
def pick_asrc(au_src):
|
|
|
22 |
pipe_fo = pipeline(model=MODEL_FO)
|
23 |
|
24 |
|
25 |
+
wdevice = "cuda" if torch.cuda.is_available() else "cpu"
|
26 |
+
whm_is = WhisperModel(model_size_or_path=MODEL_WHIS, device=wdevice)
|
27 |
|
28 |
|
29 |
|
|
|
46 |
xcp = processor.batch_decode(pred_ids)
|
47 |
return xcp[0]
|
48 |
|
49 |
+
def whrecc(audio_file,lang,wmodel):
|
50 |
wav = readwav(audio_file)
|
51 |
+
xcps, info = wmodel.transcribe(audio = audio_file, language = lang, no_repeat_ngram_size = 5)
|
52 |
+
txts = [xtp.text for xcp in xcps]
|
53 |
+
txt = ' '.join(txts)
|
54 |
+
return txt
|
|
|
55 |
|
56 |
|
57 |
def recis(audio_file):
|
|
|
68 |
|
69 |
|
70 |
def recwhis(audio_file):
|
71 |
+
wh_output = whrecc(audio_file,"is",whm_is)
|
72 |
return(wh_output)
|
73 |
|
74 |
def pick_asrc(au_src):
|