Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,12 +47,12 @@ def audio_processing(mp3_audio):
|
|
| 47 |
|
| 48 |
|
| 49 |
@st.cache_resource
|
| 50 |
-
def
|
| 51 |
asr_model = pipeline(task="automatic-speech-recognition", model="openai/whisper-large-v3")
|
| 52 |
return asr_model
|
| 53 |
|
| 54 |
def transcribe_video(_processed_audio):
|
| 55 |
-
transcriber_model =
|
| 56 |
text_extract = transcriber_model(_processed_audio)
|
| 57 |
return text_extract['text']
|
| 58 |
|
|
@@ -70,6 +70,7 @@ youtube_url_tab, file_select_tab, audio_file_tab = st.tabs(
|
|
| 70 |
|
| 71 |
with youtube_url_tab:
|
| 72 |
url = st.text_input("Enter the Youtube url")
|
|
|
|
| 73 |
try:
|
| 74 |
yt_video, title = youtube_video_downloader(url)
|
| 75 |
if url:
|
|
@@ -81,6 +82,7 @@ with youtube_url_tab:
|
|
| 81 |
if st.button("Generate Summary"):
|
| 82 |
summary = generate_ai_summary(ytvideo_transcript)
|
| 83 |
st.write(summary)
|
|
|
|
| 84 |
except Exception as e:
|
| 85 |
st.error(e)
|
| 86 |
|
|
@@ -104,6 +106,7 @@ with file_select_tab:
|
|
| 104 |
|
| 105 |
except:
|
| 106 |
st.error("Upload a valid mp4 file")
|
|
|
|
| 107 |
# Audio transcription
|
| 108 |
with audio_file_tab:
|
| 109 |
audio_file = st.file_uploader("Upload audio file", type="mp3")
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
@st.cache_resource
|
| 50 |
+
def load_asr_model():
|
| 51 |
asr_model = pipeline(task="automatic-speech-recognition", model="openai/whisper-large-v3")
|
| 52 |
return asr_model
|
| 53 |
|
| 54 |
def transcribe_video(_processed_audio):
|
| 55 |
+
transcriber_model = load_asr_model()
|
| 56 |
text_extract = transcriber_model(_processed_audio)
|
| 57 |
return text_extract['text']
|
| 58 |
|
|
|
|
| 70 |
|
| 71 |
with youtube_url_tab:
|
| 72 |
url = st.text_input("Enter the Youtube url")
|
| 73 |
+
|
| 74 |
try:
|
| 75 |
yt_video, title = youtube_video_downloader(url)
|
| 76 |
if url:
|
|
|
|
| 82 |
if st.button("Generate Summary"):
|
| 83 |
summary = generate_ai_summary(ytvideo_transcript)
|
| 84 |
st.write(summary)
|
| 85 |
+
|
| 86 |
except Exception as e:
|
| 87 |
st.error(e)
|
| 88 |
|
|
|
|
| 106 |
|
| 107 |
except:
|
| 108 |
st.error("Upload a valid mp4 file")
|
| 109 |
+
|
| 110 |
# Audio transcription
|
| 111 |
with audio_file_tab:
|
| 112 |
audio_file = st.file_uploader("Upload audio file", type="mp3")
|