Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,8 +17,8 @@ from transformers import (
|
|
17 |
Trainer,
|
18 |
pipeline
|
19 |
)
|
20 |
-
|
21 |
-
|
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('/
|
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('/
|
121 |
|
122 |
|
123 |
def twitch_loader(link):
|
124 |
os.system(f"twitch-dl download -q audio_only {link} --output twitch.wav")
|
125 |
-
return process('/
|
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:
|