Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from googletrans import Translator
|
|
5 |
from pydub import AudioSegment
|
6 |
import os
|
7 |
import tempfile
|
|
|
8 |
|
9 |
def extract_audio(video_path):
|
10 |
video = mp.VideoFileClip(video_path)
|
@@ -13,6 +14,7 @@ def extract_audio(video_path):
|
|
13 |
audio.write_audiofile(audio_path)
|
14 |
return audio_path
|
15 |
|
|
|
16 |
def generate_subtitles(audio_path):
|
17 |
model = whisper.load_model("base")
|
18 |
result = model.transcribe(audio_path)
|
|
|
5 |
from pydub import AudioSegment
|
6 |
import os
|
7 |
import tempfile
|
8 |
+
import spaces
|
9 |
|
10 |
def extract_audio(video_path):
|
11 |
video = mp.VideoFileClip(video_path)
|
|
|
14 |
audio.write_audiofile(audio_path)
|
15 |
return audio_path
|
16 |
|
17 |
+
@spaces.GPU
|
18 |
def generate_subtitles(audio_path):
|
19 |
model = whisper.load_model("base")
|
20 |
result = model.transcribe(audio_path)
|