DiegoLigtenberg commited on
Commit
863cbdb
·
1 Parent(s): 8afe900
Files changed (1) hide show
  1. app.py +28 -26
app.py CHANGED
@@ -55,37 +55,39 @@ if "transcription" in st.session_state:
55
  st.session_state.transcription.whisper()
56
 
57
  # create two columns to separate page and youtube video
58
- transcription_col, media_col = st.columns(2, gap="large")
59
-
60
- transcription_col.markdown("#### Audio")
61
- with open(st.session_state.transcription.audio_path, "rb") as f:
62
- transcription_col.audio(f.read())
63
- transcription_col.markdown("---")
64
- transcription_col.markdown(f"#### Transcription (whisper model - `{whisper_model}`)")
65
- transcription_col.markdown(f"##### Language: `{st.session_state.transcription.language}`")
 
66
 
67
- # Trim raw transcribed output off tokens to simplify
68
- raw_output = transcription_col.expander("Raw output")
69
- raw_output.markdown(st.session_state.transcription.raw_output["text"])
70
 
71
- if summary:
72
- summarized_output = transcription_col.expander("summarized output")
73
- # CURRENTLY ONLY SUPPORTS 1024 WORD TOKENS -> TODO: FIND METHOD TO INCREASE SUMMARY FOR LONGER VIDS -> 1024 * 4 = aprox 800 words within 1024 range
74
- text_summary = TextToSummary(str(st.session_state.transcription.text[:1024*4]),min_sum,max_sum).get_summary()
75
- summarized_output.markdown(text_summary[0]["summary_text"])
76
 
77
- # Show transcription in format with timers added to text
78
- time_annotated_output = transcription_col.expander("time_annotated_output")
79
- for segment in st.session_state.transcription.segments:
80
- time_annotated_output.markdown(
81
- f"""[{round(segment["start"], 1)} - {round(segment["end"], 1)}] - {segment["text"]}"""
82
- )
83
 
84
  # Show input youtube video
85
- if input_type == "YouTube":
86
- media_col.markdown("---")
87
- media_col.markdown("#### Original YouTube Video")
88
- media_col.video(st.session_state.transcription.source)
 
89
  else:
90
  pass
91
 
 
55
  st.session_state.transcription.whisper()
56
 
57
  # create two columns to separate page and youtube video
58
+ transcription_col, media_col = st.columns(2)
59
+
60
+ with transcription_col:
61
+ st.markdown("#### Audio")
62
+ with open(st.session_state.transcription.audio_path, "rb") as f:
63
+ st.audio(f.read())
64
+ st.markdown("---")
65
+ st.markdown(f"#### Transcription (whisper model - `{whisper_model}`)")
66
+ st.markdown(f"##### Language: `{st.session_state.transcription.language}`")
67
 
68
+ # Trim raw transcribed output off tokens to simplify
69
+ raw_output = st.expander("Raw output")
70
+ raw_output.markdown(st.session_state.transcription.raw_output["text"])
71
 
72
+ if summary:
73
+ summarized_output = st.expander("summarized output")
74
+ # CURRENTLY ONLY SUPPORTS 1024 WORD TOKENS -> TODO: FIND METHOD TO INCREASE SUMMARY FOR LONGER VIDS -> 1024 * 4 = aprox 800 words within 1024 range
75
+ text_summary = TextToSummary(str(st.session_state.transcription.text[:1024*4]),min_sum,max_sum).get_summary()
76
+ summarized_output.markdown(text_summary[0]["summary_text"])
77
 
78
+ # Show transcription in format with timers added to text
79
+ time_annotated_output = st.expander("time_annotated_output")
80
+ for segment in st.session_state.transcription.segments:
81
+ time_annotated_output.markdown(
82
+ f"""[{round(segment["start"], 1)} - {round(segment["end"], 1)}] - {segment["text"]}"""
83
+ )
84
 
85
  # Show input youtube video
86
+ with media_col:
87
+ if input_type == "YouTube":
88
+ st.markdown("---")
89
+ st.markdown("#### Original YouTube Video")
90
+ st.video(st.session_state.transcription.source)
91
  else:
92
  pass
93