versae commited on
Commit
f5e579f
·
verified ·
1 Parent(s): 983c638

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -25,7 +25,6 @@ def transcribe(file): #microphone, file_upload):
25
  device=device,
26
  token=auth_token,
27
  )
28
-
29
  pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
30
  #pipe.to(device)
31
  warn_output = ""
@@ -55,6 +54,15 @@ def _return_yt_html_embed(yt_url):
55
 
56
 
57
  def yt_transcribe(yt_url):
 
 
 
 
 
 
 
 
 
58
  yt = pt.YouTube(yt_url)
59
  html_embed_str = _return_yt_html_embed(yt_url)
60
  stream = yt.streams.filter(only_audio=True)[0]
 
25
  device=device,
26
  token=auth_token,
27
  )
 
28
  pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
29
  #pipe.to(device)
30
  warn_output = ""
 
54
 
55
 
56
  def yt_transcribe(yt_url):
57
+ pipe = pipeline(
58
+ task="automatic-speech-recognition",
59
+ model=MODEL_NAME,
60
+ chunk_length_s=30,
61
+ device=device,
62
+ token=auth_token,
63
+ )
64
+ pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
65
+
66
  yt = pt.YouTube(yt_url)
67
  html_embed_str = _return_yt_html_embed(yt_url)
68
  stream = yt.streams.filter(only_audio=True)[0]