Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -262,7 +262,7 @@ with col1:
|
|
| 262 |
|
| 263 |
st.title("Insightly Video")
|
| 264 |
stream_url = st.text_input("Enter the live stream URL (YouTube, Twitch, etc.):")
|
| 265 |
-
keyword = st.text_input("Enter a keyword to filter the frames (optional):")
|
| 266 |
extract_frames_button = st.button("Extract Frames")
|
| 267 |
uploaded_video = st.file_uploader("Or upload a video file (MP4):", type=["mp4"])
|
| 268 |
prompt1 = "keyword is " + st.text_input("Enter a keyword for analysis:")
|
|
@@ -296,7 +296,7 @@ with col1:
|
|
| 296 |
else:
|
| 297 |
st.write("Please upload an MP3 file to get started.")
|
| 298 |
|
| 299 |
-
if extract_frames_button and stream_url
|
| 300 |
# Execute FFmpeg command to extract frames
|
| 301 |
|
| 302 |
# Check if URL is provided
|
|
@@ -341,17 +341,6 @@ with col1:
|
|
| 341 |
extracted_text = extract_text_from_base64_frame(frame_base64)
|
| 342 |
frame_texts[idx] = extracted_text
|
| 343 |
|
| 344 |
-
if not keyword or keyword.lower() in extracted_text.lower():
|
| 345 |
-
col1, col2 = st.columns([3, 2])
|
| 346 |
-
with col1:
|
| 347 |
-
frame_bytes = base64.b64decode(frame_base64)
|
| 348 |
-
st.image(Image.open(BytesIO(frame_bytes)), caption=f'Frame {idx + 1}', use_column_width=True)
|
| 349 |
-
with col2:
|
| 350 |
-
st.write(f"Extracted Text: {extracted_text}")
|
| 351 |
-
if keyword:
|
| 352 |
-
st.write(f"Displaying frames containing the keyword '{keyword}'.")
|
| 353 |
-
else:
|
| 354 |
-
st.write("Displaying all extracted frames.")
|
| 355 |
# Use Streamlit columns for side-by-side display (1 column for image, 1 for text)
|
| 356 |
# col1, col2 = st.columns([3, 2])
|
| 357 |
# with col1:
|
|
@@ -427,11 +416,6 @@ with col1:
|
|
| 427 |
else:
|
| 428 |
st.write("Failed to generate overall description.")
|
| 429 |
|
| 430 |
-
if keyword:
|
| 431 |
-
st.write(f"Displaying frames containing the keyword '{keyword}'.")
|
| 432 |
-
else:
|
| 433 |
-
st.write("Displaying all extracted frames.")
|
| 434 |
-
|
| 435 |
elif uploaded_video is not None and extract_frames_button:
|
| 436 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmpfile:
|
| 437 |
tmpfile.write(uploaded_video.getvalue())
|
|
|
|
| 262 |
|
| 263 |
st.title("Insightly Video")
|
| 264 |
stream_url = st.text_input("Enter the live stream URL (YouTube, Twitch, etc.):")
|
| 265 |
+
#keyword = st.text_input("Enter a keyword to filter the frames (optional):")
|
| 266 |
extract_frames_button = st.button("Extract Frames")
|
| 267 |
uploaded_video = st.file_uploader("Or upload a video file (MP4):", type=["mp4"])
|
| 268 |
prompt1 = "keyword is " + st.text_input("Enter a keyword for analysis:")
|
|
|
|
| 296 |
else:
|
| 297 |
st.write("Please upload an MP3 file to get started.")
|
| 298 |
|
| 299 |
+
if extract_frames_button and stream_url:
|
| 300 |
# Execute FFmpeg command to extract frames
|
| 301 |
|
| 302 |
# Check if URL is provided
|
|
|
|
| 341 |
extracted_text = extract_text_from_base64_frame(frame_base64)
|
| 342 |
frame_texts[idx] = extracted_text
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
# Use Streamlit columns for side-by-side display (1 column for image, 1 for text)
|
| 345 |
# col1, col2 = st.columns([3, 2])
|
| 346 |
# with col1:
|
|
|
|
| 416 |
else:
|
| 417 |
st.write("Failed to generate overall description.")
|
| 418 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
elif uploaded_video is not None and extract_frames_button:
|
| 420 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmpfile:
|
| 421 |
tmpfile.write(uploaded_video.getvalue())
|