Skip to content

Commit

Permalink
add comment for video associated png
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Aug 28, 2024
1 parent 095943c commit b0a464b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions vision_agent/lmm/lmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def encode_image_bytes(image: bytes) -> str:

def encode_media(media: Union[str, Path]) -> str:
if type(media) is str and media.startswith(("http", "https")):
if media.endswith(".mp4"):
# for mp4 video url, we assume there is a same url but ends with png
# vision-agent-ui will upload this png when uploading the video
if media.endswith((".mp4", "mov")):
return media[:-4] + ".png"
return media
extension = "png"
Expand Down Expand Up @@ -396,7 +398,6 @@ def chat(
tmp_kwargs = self.kwargs | kwargs
data.update(tmp_kwargs)
if "stream" in tmp_kwargs and tmp_kwargs["stream"]:

json_data = json.dumps(data)

def f() -> Iterator[Optional[str]]:
Expand Down Expand Up @@ -430,7 +431,6 @@ def generate(
media: Optional[List[Union[str, Path]]] = None,
**kwargs: Any,
) -> Union[str, Iterator[Optional[str]]]:

url = f"{self.url}/generate"
data: Dict[str, Any] = {
"model": self.model_name,
Expand All @@ -445,7 +445,6 @@ def generate(
tmp_kwargs = self.kwargs | kwargs
data.update(tmp_kwargs)
if "stream" in tmp_kwargs and tmp_kwargs["stream"]:

json_data = json.dumps(data)

def f() -> Iterator[Optional[str]]:
Expand Down

0 comments on commit b0a464b

Please sign in to comment.