Paul Ke commited on
Commit
3e89b76
·
verified ·
1 Parent(s): 024efa5

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +7 -4
streamlit_app.py CHANGED
@@ -128,14 +128,14 @@ def convert_video_to_mp4(video_path):
128
  # --- Streamlit App ---
129
 
130
  # Main content
131
- st.button(
132
  "Clear Videos",
133
  on_click=_remove_all_videos,
134
  type="secondary",
135
  help="Clear all downloaded videos",
136
  )
137
 
138
- st.text_input(
139
  "Video URL",
140
  key="url",
141
  placeholder="Enter Video URL and Hit Enter",
@@ -176,17 +176,20 @@ if st.session_state["videos"]:
176
  except Exception as e:
177
  st.error("Failed downloading the video", icon="😔")
178
 
 
 
 
179
  # Analysis prompt
180
  analysis_prompt = st.sidebar.text_area("Enter analysis")
181
 
182
  if st.button('Generate the story'):
183
- if not url:
184
  st.sidebar.warning('PLEASE ENTER A VALID URL')
185
  else:
186
  # Download the video
187
  with st.spinner("Retrieving video..."):
188
  temp_video_path = os.path.join(tempfile.gettempdir(), 'video.mp4')
189
- success, message = download_video(url, temp_video_path)
190
 
191
  if not success:
192
  st.sidebar.error(f"Error downloading video: {message}")
 
128
  # --- Streamlit App ---
129
 
130
  # Main content
131
+ st.sidebar.button(
132
  "Clear Videos",
133
  on_click=_remove_all_videos,
134
  type="secondary",
135
  help="Clear all downloaded videos",
136
  )
137
 
138
+ st.sidebar.text_input(
139
  "Video URL",
140
  key="url",
141
  placeholder="Enter Video URL and Hit Enter",
 
176
  except Exception as e:
177
  st.error("Failed downloading the video", icon="😔")
178
 
179
+ # URL input for video
180
+ video_url=f"{st.session_state['videos'].lower().translate(str.maketrans('', '', string.punctuation)).replace(' ', '_')}.mp4
181
+
182
  # Analysis prompt
183
  analysis_prompt = st.sidebar.text_area("Enter analysis")
184
 
185
  if st.button('Generate the story'):
186
+ if not video_url:
187
  st.sidebar.warning('PLEASE ENTER A VALID URL')
188
  else:
189
  # Download the video
190
  with st.spinner("Retrieving video..."):
191
  temp_video_path = os.path.join(tempfile.gettempdir(), 'video.mp4')
192
+ success, message = download_video(video_url, temp_video_path)
193
 
194
  if not success:
195
  st.sidebar.error(f"Error downloading video: {message}")