ricardo-lsantos commited on
Commit
6faf1b6
·
1 Parent(s): f433e21

Added subtitle download and transcript download

Browse files
Files changed (1) hide show
  1. Home.py +18 -2
Home.py CHANGED
@@ -51,13 +51,29 @@ def app():
51
  status_text.text('Subtitling audio...')
52
  subtitles = mw.get_prediction_with_timelines(transcript, file.name + '.srt')
53
  progress_bar.progress(90)
54
- status_text.text('Saving transcript...')
55
- ms.save_subtitles(subtitles, file.name + '.srt')
56
  status_text.text('Saving subtitles...')
 
 
 
 
 
57
  mt.save_transcript(transcript, file.name + '.txt')
58
  status_text.text('Done!')
59
  progress_bar.progress(100)
60
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  if __name__ == '__main__':
63
  app()
 
51
  status_text.text('Subtitling audio...')
52
  subtitles = mw.get_prediction_with_timelines(transcript, file.name + '.srt')
53
  progress_bar.progress(90)
54
+
 
55
  status_text.text('Saving subtitles...')
56
+ st.session_state['subtitles'] = subtitles
57
+ ms.save_subtitles(subtitles, file.name + '.srt')
58
+
59
+ status_text.text('Saving transcript...')
60
+ st.session_state['transcript'] = transcript
61
  mt.save_transcript(transcript, file.name + '.txt')
62
  status_text.text('Done!')
63
  progress_bar.progress(100)
64
 
65
+ st.download_button(
66
+ label="Download Transcript",
67
+ data=st.session_state['transcript'],
68
+ file_name=file.name + '.txt',
69
+ mime='text/plain'
70
+ )
71
+ st.download_button(
72
+ label="Download Subtitles",
73
+ data=st.session_state['subtitles'],
74
+ file_name=file.name + '.srt',
75
+ mime='text/plain'
76
+ )
77
 
78
  if __name__ == '__main__':
79
  app()