marquesafonso commited on
Commit
76e7e2a
1 Parent(s): 861c879

add delete_cache daily. add copy button to textbox

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,19 +2,19 @@ import gradio as gr
2
  from src.transcriber import transcriber
3
 
4
  def main():
5
- with gr.Blocks(title='multilang-asr-transcriber') as demo:
6
  gr.Markdown('# multilang-asr-transcriber')
7
  gr.Markdown('### A multilingual automatic speech transcription tool using [faster-whisper](https://github.com/SYSTRAN/faster-whisper). Supports translation to english and user setting of max words per line.')
8
  video_file = gr.File(file_types=["video"],type="filepath", label="Upload a video")
9
  max_words_per_line = gr.Number(value=6, label="Max words per line")
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", type="filepath", 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
- demo.launch(allowed_paths=["https://marquesafonso-multilang-asr-transcriber.hf.space/file=/tmp/gradio/", "file=/tmp/gradio/", "/tmp/gradio/"])
18
 
19
  if __name__ == '__main__':
20
  main()
 
2
  from src.transcriber import transcriber
3
 
4
  def main():
5
+ with gr.Blocks(title='multilang-asr-transcriber', delete_cache=(86400, 86400)) as demo:
6
  gr.Markdown('# multilang-asr-transcriber')
7
  gr.Markdown('### A multilingual automatic speech transcription tool using [faster-whisper](https://github.com/SYSTRAN/faster-whisper). Supports translation to english and user setting of max words per line.')
8
  video_file = gr.File(file_types=["video"],type="filepath", label="Upload a video")
9
  max_words_per_line = gr.Number(value=6, label="Max words per line")
10
  task = gr.Dropdown(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
11
+ text_output = gr.Textbox(label="Text transcription", show_copy_button=True)
12
  srt_file = gr.File(file_count="single", type="filepath", 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
+ demo.launch()
18
 
19
  if __name__ == '__main__':
20
  main()