BALAKA commited on
Commit
c36f753
·
1 Parent(s): 06a3c62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -17,8 +17,8 @@ from transformers import (
17
  Trainer,
18
  pipeline
19
  )
20
- # processor = Wav2Vec2Processor.from_pretrained("airesearch/wav2vec2-large-xlsr-53-th")
21
- # model = Wav2Vec2ForCTC.from_pretrained("BALAKA/wav2vec2-large-xlsr-53-thai")
22
 
23
  demo = gr.Blocks()
24
 
@@ -50,7 +50,7 @@ def tran_script(file_path):
50
  predicted_sentence = processor.batch_decode(predicted_ids)
51
  return predicted_sentence
52
  else:
53
- now_path = glob('/content/split_*.mp3')
54
  sentence = []
55
  for i in range(file_path - 1):
56
  now_path = f'/content/split_{i+1}.mp3'
@@ -115,14 +115,13 @@ def youtube_loader(link):
115
  yt = YouTube(str(link))
116
  video = yt.streams.filter(only_audio=True).first()
117
  out_file = video.download(output_path='mp3')
118
- return out_file
119
  os.rename(out_file, 'youtube.mp3')
120
- return process('/content/mp3/youtube.mp3')
121
 
122
 
123
  def twitch_loader(link):
124
  os.system(f"twitch-dl download -q audio_only {link} --output twitch.wav")
125
- return process('/content/twitch.wav')
126
 
127
 
128
  with demo:
 
17
  Trainer,
18
  pipeline
19
  )
20
+ processor = Wav2Vec2Processor.from_pretrained("airesearch/wav2vec2-large-xlsr-53-th")
21
+ model = Wav2Vec2ForCTC.from_pretrained("BALAKA/wav2vec2-large-xlsr-53-thai")
22
 
23
  demo = gr.Blocks()
24
 
 
50
  predicted_sentence = processor.batch_decode(predicted_ids)
51
  return predicted_sentence
52
  else:
53
+ now_path = glob('/home/user/app/split_*.mp3')
54
  sentence = []
55
  for i in range(file_path - 1):
56
  now_path = f'/content/split_{i+1}.mp3'
 
115
  yt = YouTube(str(link))
116
  video = yt.streams.filter(only_audio=True).first()
117
  out_file = video.download(output_path='mp3')
 
118
  os.rename(out_file, 'youtube.mp3')
119
+ return process('/home/user/app/mp3/youtube.mp3')
120
 
121
 
122
  def twitch_loader(link):
123
  os.system(f"twitch-dl download -q audio_only {link} --output twitch.wav")
124
+ return process('/home/user/app/twitch.wav')
125
 
126
 
127
  with demo: