Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,6 +64,7 @@ def generate_ai_summary(transcript):
|
|
64 |
return model_response.text
|
65 |
|
66 |
|
|
|
67 |
# Streamlit UI
|
68 |
|
69 |
youtube_url_tab, file_select_tab, audio_file_tab = st.tabs(
|
@@ -73,21 +74,21 @@ youtube_url_tab, file_select_tab, audio_file_tab = st.tabs(
|
|
73 |
with youtube_url_tab:
|
74 |
url = st.text_input("Enter the Youtube url")
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
|
92 |
except Exception as e:
|
93 |
st.error(f"Enter a valid url: {e}")
|
@@ -96,25 +97,24 @@ with youtube_url_tab:
|
|
96 |
|
97 |
with file_select_tab:
|
98 |
uploaded_video_file = st.file_uploader("Upload video file", type="mp4")
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
114 |
|
115 |
|
116 |
-
except Exception as e:
|
117 |
-
st.error(e)
|
118 |
|
119 |
# Audio transcription
|
120 |
with audio_file_tab:
|
|
|
64 |
return model_response.text
|
65 |
|
66 |
|
67 |
+
|
68 |
# Streamlit UI
|
69 |
|
70 |
youtube_url_tab, file_select_tab, audio_file_tab = st.tabs(
|
|
|
74 |
with youtube_url_tab:
|
75 |
url = st.text_input("Enter the Youtube url")
|
76 |
|
77 |
+
|
78 |
+
yt_video, title = youtube_video_downloader(url)
|
79 |
+
if url:
|
80 |
+
if st.button("Transcribe", key="yturl"):
|
81 |
+
with st.spinner("Transcribing..."):
|
82 |
+
audio = audio_extraction(yt_video, "mp3")
|
83 |
+
audio = audio_processing(audio)
|
84 |
+
ytvideo_transcript = transcriber_pass(audio)
|
85 |
+
st.success(f"Transcription successful")
|
86 |
+
st.write(ytvideo_transcript)
|
87 |
+
# st.write(f'Completed in {run_time}')
|
88 |
+
|
89 |
+
if st.button("Generate Summary"):
|
90 |
+
summary = generate_ai_summary(ytvideo_transcript)
|
91 |
+
st.write(summary)
|
92 |
|
93 |
except Exception as e:
|
94 |
st.error(f"Enter a valid url: {e}")
|
|
|
97 |
|
98 |
with file_select_tab:
|
99 |
uploaded_video_file = st.file_uploader("Upload video file", type="mp4")
|
100 |
+
|
101 |
+
|
102 |
+
if video_file:
|
103 |
+
video_file = uploaded_video_file.read()
|
104 |
+
|
105 |
+
if st.button("Transcribe", key="vidfile"):
|
106 |
+
with st.spinner("Transcribing..."):
|
107 |
+
audio = audio_extraction(os.fspath(video_file), "mp3")
|
108 |
+
audio = audio_processing(audio)
|
109 |
+
video_transcript = transcriber_pass(audio)
|
110 |
+
st.success(f"Transcription successful")
|
111 |
+
st.write(video_transcript)
|
112 |
+
|
113 |
+
if st.button("Generate Summary", key="ti2"):
|
114 |
+
summary = generate_ai_summary(video_transcript)
|
115 |
+
st.write(summary)
|
116 |
|
117 |
|
|
|
|
|
118 |
|
119 |
# Audio transcription
|
120 |
with audio_file_tab:
|