tensorkelechi commited on
Commit
aa86aaf
·
verified ·
1 Parent(s): e5255a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -32
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
- try:
77
- yt_video, title = youtube_video_downloader(url)
78
- if url:
79
- if st.button("Transcribe", key="yturl"):
80
- with st.spinner("Transcribing..."):
81
- audio = audio_extraction(yt_video, "mp3")
82
- audio = audio_processing(audio)
83
- ytvideo_transcript = transcriber_pass(audio)
84
- st.success(f"Transcription successful")
85
- st.write(ytvideo_transcript)
86
- # st.write(f'Completed in {run_time}')
87
-
88
- if st.button("Generate Summary"):
89
- summary = generate_ai_summary(ytvideo_transcript)
90
- st.write(summary)
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
- video_file = uploaded_video_file.read()
100
- try:
101
-
102
- if video_file:
103
- if st.button("Transcribe", key="vidfile"):
104
- with st.spinner("Transcribing..."):
105
- audio = audio_extraction(os.fspath(video_file), "mp3")
106
- audio = audio_processing(audio)
107
- video_transcript = transcriber_pass(audio)
108
- st.success(f"Transcription successful")
109
- st.write(video_transcript)
110
-
111
- if st.button("Generate Summary", key="ti2"):
112
- summary = generate_ai_summary(video_transcript)
113
- st.write(summary)
 
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: