Spaces:
Runtime error
Runtime error
Added GPU Models
Browse files- main.py +6 -5
- transcription.py +1 -2
main.py
CHANGED
@@ -14,13 +14,10 @@ from s3_handler import S3Handler
|
|
14 |
from media_download import YoutubeDownloader
|
15 |
from transcription import StableWhisper
|
16 |
from summarizer import Extract_Summary, AudioBookNarration
|
17 |
-
from audiobook import AudioBook
|
18 |
|
19 |
|
20 |
|
21 |
-
# For Storing Models
|
22 |
-
global MODELS
|
23 |
-
|
24 |
### API Configurations
|
25 |
|
26 |
# Context Manager for FastAPI Start/Shutdown
|
@@ -31,7 +28,11 @@ async def lifespan(app: FastAPI):
|
|
31 |
|
32 |
# Loading ML models
|
33 |
print('Loading ML Models..')
|
|
|
|
|
|
|
34 |
MODELS = load_models()
|
|
|
35 |
print('ML Models Loaded!')
|
36 |
|
37 |
yield
|
@@ -228,7 +229,7 @@ async def get_translation(user_id: str, target_language: str = 'en'):
|
|
228 |
|
229 |
# NLLB based Translation
|
230 |
user_folder_path = os.path.join(output_folder, user_id)
|
231 |
-
nllb_translator = Translation(model=MODELS['
|
232 |
transcript_dict=transcript,
|
233 |
source_lang=transcript['language'],
|
234 |
target_lang=target_language,
|
|
|
14 |
from media_download import YoutubeDownloader
|
15 |
from transcription import StableWhisper
|
16 |
from summarizer import Extract_Summary, AudioBookNarration
|
17 |
+
# from audiobook import AudioBook
|
18 |
|
19 |
|
20 |
|
|
|
|
|
|
|
21 |
### API Configurations
|
22 |
|
23 |
# Context Manager for FastAPI Start/Shutdown
|
|
|
28 |
|
29 |
# Loading ML models
|
30 |
print('Loading ML Models..')
|
31 |
+
|
32 |
+
# For Storing Models
|
33 |
+
global MODELS
|
34 |
MODELS = load_models()
|
35 |
+
|
36 |
print('ML Models Loaded!')
|
37 |
|
38 |
yield
|
|
|
229 |
|
230 |
# NLLB based Translation
|
231 |
user_folder_path = os.path.join(output_folder, user_id)
|
232 |
+
nllb_translator = Translation(model=MODELS['translation'],
|
233 |
transcript_dict=transcript,
|
234 |
source_lang=transcript['language'],
|
235 |
target_lang=target_language,
|
transcription.py
CHANGED
@@ -77,9 +77,8 @@ class YouTubeTranscriptAPI(Transcription):
|
|
77 |
|
78 |
|
79 |
class Whisper(Transcription):
|
80 |
-
def __init__(self,
|
81 |
super().__init__(media_path, output_path, subtitle_format)
|
82 |
-
self.model = model
|
83 |
self.word_level = word_level
|
84 |
self.supported_subtitle_formats = ['ass', 'srt', 'vtt']
|
85 |
assert(self.subtitle_format.lower() in self.supported_subtitle_formats)
|
|
|
77 |
|
78 |
|
79 |
class Whisper(Transcription):
|
80 |
+
def __init__(self, media_path, output_path, subtitle_format, word_level):
|
81 |
super().__init__(media_path, output_path, subtitle_format)
|
|
|
82 |
self.word_level = word_level
|
83 |
self.supported_subtitle_formats = ['ass', 'srt', 'vtt']
|
84 |
assert(self.subtitle_format.lower() in self.supported_subtitle_formats)
|