Spaces:
Build error
Build error
Commit
·
863cbdb
1
Parent(s):
8afe900
working
Browse files
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
|
59 |
-
|
60 |
-
transcription_col
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
# Show input youtube video
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
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 |
|