TaahKay commited on
Commit
250c588
·
verified ·
1 Parent(s): 55992ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -22
app.py CHANGED
@@ -43,29 +43,28 @@ if not shutil.which("ffmpeg"):
43
 
44
 
45
  # Input options
46
- if "audio_path" not in st.session_state:
47
- option = st.radio("Choose input method:", ["Upload video file", "Enter Video Url"])
48
-
49
- if option == "Upload video file":
50
- uploaded_video = st.file_uploader("Upload your video", type=["mp4", "mov", "avi", "mkv"])
51
- if uploaded_video is not None:
52
- temp_video_path = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
53
- with open(temp_video_path.name, "wb") as f:
54
- f.write(uploaded_video.read())
55
- audio_path = trim_video(temp_video_path.name)
56
- st.success("Video uploaded successfully.")
 
 
 
 
 
 
 
 
 
 
57
  st.session_state.audio_path = audio_path
58
-
59
-
60
- elif option == "Enter Video Url":
61
- yt_url = st.text_input("Paste YouTube URL")
62
- if st.button("Download Video"):
63
- with st.spinner("Downloading video..."):
64
- audio_path = download_audio_as_wav(yt_url)
65
- audio_path = trim_audio(audio_path)
66
- if audio_path:
67
- st.success("Video downloaded successfully.")
68
- st.session_state.audio_path = audio_path
69
 
70
 
71
  # Transcription and Accent Analysis
 
43
 
44
 
45
  # Input options
46
+ option = st.radio("Choose input method:", ["Upload video file", "Enter Video Url"])
47
+
48
+ if option == "Upload video file":
49
+ uploaded_video = st.file_uploader("Upload your video", type=["mp4", "mov", "avi", "mkv"])
50
+ if uploaded_video is not None:
51
+ temp_video_path = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4")
52
+ with open(temp_video_path.name, "wb") as f:
53
+ f.write(uploaded_video.read())
54
+ audio_path = trim_video(temp_video_path.name)
55
+ st.success("Video uploaded successfully.")
56
+ st.session_state.audio_path = audio_path
57
+
58
+
59
+ elif option == "Enter Video Url":
60
+ yt_url = st.text_input("Paste YouTube URL")
61
+ if st.button("Download Video"):
62
+ with st.spinner("Downloading video..."):
63
+ audio_path = download_audio_as_wav(yt_url)
64
+ audio_path = trim_audio(audio_path)
65
+ if audio_path:
66
+ st.success("Video downloaded successfully.")
67
  st.session_state.audio_path = audio_path
 
 
 
 
 
 
 
 
 
 
 
68
 
69
 
70
  # Transcription and Accent Analysis