marquesafonso
commited on
Commit
·
5f974dc
1
Parent(s):
3710621
set static paths to include srt file (2)
Browse files- app.py +1 -2
- src/transcriber.py +1 -0
app.py
CHANGED
@@ -10,13 +10,12 @@ def main():
|
|
10 |
task = gr.Dropdown(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
11 |
text_output = gr.Textbox(label="Text transcription")
|
12 |
srt_file = gr.File(file_count="single", file_types=[".srt"], label="SRT file")
|
13 |
-
gr.set_static_paths(paths=[srt_file])
|
14 |
gr.Interface(transcriber,
|
15 |
inputs=[video_file, max_words_per_line, task],
|
16 |
outputs=[text_output,srt_file],
|
17 |
allow_flagging="never",
|
18 |
analytics_enabled=False)
|
19 |
-
demo.launch(
|
20 |
|
21 |
if __name__ == '__main__':
|
22 |
main()
|
|
|
10 |
task = gr.Dropdown(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
11 |
text_output = gr.Textbox(label="Text transcription")
|
12 |
srt_file = gr.File(file_count="single", file_types=[".srt"], label="SRT file")
|
|
|
13 |
gr.Interface(transcriber,
|
14 |
inputs=[video_file, max_words_per_line, task],
|
15 |
outputs=[text_output,srt_file],
|
16 |
allow_flagging="never",
|
17 |
analytics_enabled=False)
|
18 |
+
demo.launch()
|
19 |
|
20 |
if __name__ == '__main__':
|
21 |
main()
|
src/transcriber.py
CHANGED
@@ -45,6 +45,7 @@ def transcriber(video_input:gr.File,
|
|
45 |
max_words_per_line:int,
|
46 |
task:str):
|
47 |
srt_filepath = os.path.normpath(f"{video_input.split('.')[0]}.srt")
|
|
|
48 |
audio_input = convert_video_to_audio(video_input)
|
49 |
model_size = "large-v3"
|
50 |
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|
|
|
45 |
max_words_per_line:int,
|
46 |
task:str):
|
47 |
srt_filepath = os.path.normpath(f"{video_input.split('.')[0]}.srt")
|
48 |
+
gr.set_static_paths(paths=[srt_filepath])
|
49 |
audio_input = convert_video_to_audio(video_input)
|
50 |
model_size = "large-v3"
|
51 |
model = WhisperModel(model_size, device="cpu", compute_type="int8")
|