Skip to content

Commit

Permalink
Bugfix for follow-up query with a .png image (opea-project#900)
Browse files Browse the repository at this point in the history
* MultimodalQnA bugfix for follow-up query with a .png image

Signed-off-by: Melanie Buehler <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Melanie Buehler <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Abolfazl Shahbazi <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2024
1 parent 0163ea6 commit 405a632
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions comps/dataprep/multimodal/redis/langchain/multimodal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def extract_frames_and_generate_captions(
# Set up location to store frames and annotations
os.makedirs(output_dir, exist_ok=True)
os.makedirs(os.path.join(output_dir, "frames"), exist_ok=True)
is_video = os.path.splitext(video_path)[-1] == ".mp4"

# Load video and get fps
vidcap = cv2.VideoCapture(video_path)
Expand Down Expand Up @@ -294,8 +295,8 @@ def extract_frames_and_generate_captions(
"video_name": os.path.basename(video_path),
"b64_img_str": b64_img_str,
"caption": text,
"time": mid_time_ms,
"frame_no": frame_no,
"time": mid_time_ms if is_video else 0.0,
"frame_no": frame_no if is_video else 0,
"sub_video_id": idx,
}
)
Expand Down

0 comments on commit 405a632

Please sign in to comment.