mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-03 17:29:01 +00:00
remove comments prints
This commit is contained in:
parent
50b1487244
commit
a720928a1c
1 changed files with 2 additions and 24 deletions
|
@ -117,8 +117,9 @@ async def interleaved_content_convert_to_raw(
|
||||||
return RawTextItem(text=c.text)
|
return RawTextItem(text=c.text)
|
||||||
elif isinstance(c, ImageContentItem):
|
elif isinstance(c, ImageContentItem):
|
||||||
if c.url:
|
if c.url:
|
||||||
|
# Load image bytes from URL
|
||||||
if c.url.uri.startswith("data"):
|
if c.url.uri.startswith("data"):
|
||||||
match = re.match(r"data:image/(\w+);base64,(.+)", img.uri)
|
match = re.match(r"data:image/(\w+);base64,(.+)", c.url.uri)
|
||||||
if not match:
|
if not match:
|
||||||
raise ValueError("Invalid data URL format")
|
raise ValueError("Invalid data URL format")
|
||||||
_, image_data = match.groups()
|
_, image_data = match.groups()
|
||||||
|
@ -138,29 +139,6 @@ async def interleaved_content_convert_to_raw(
|
||||||
else:
|
else:
|
||||||
raise ValueError("No data or URL provided")
|
raise ValueError("No data or URL provided")
|
||||||
|
|
||||||
# # load image and return PIL version
|
|
||||||
# img = c.data
|
|
||||||
# if isinstance(img, URL):
|
|
||||||
# if img.uri.startswith("data"):
|
|
||||||
# match = re.match(r"data:image/(\w+);base64,(.+)", img.uri)
|
|
||||||
# if not match:
|
|
||||||
# raise ValueError("Invalid data URL format")
|
|
||||||
# _, image_data = match.groups()
|
|
||||||
# data = base64.b64decode(image_data)
|
|
||||||
# elif img.uri.startswith("file://"):
|
|
||||||
# path = img.uri[len("file://") :]
|
|
||||||
# with open(path, "rb") as f:
|
|
||||||
# data = f.read() # type: ignore
|
|
||||||
# elif img.uri.startswith("http"):
|
|
||||||
# async with httpx.AsyncClient() as client:
|
|
||||||
# response = await client.get(img.uri)
|
|
||||||
# data = response.content
|
|
||||||
# else:
|
|
||||||
# raise ValueError("Unsupported URL type")
|
|
||||||
# else:
|
|
||||||
# data = c.data
|
|
||||||
|
|
||||||
print("type of data", type(data))
|
|
||||||
return RawMediaItem(data=data)
|
return RawMediaItem(data=data)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unsupported content type: {type(c)}")
|
raise ValueError(f"Unsupported content type: {type(c)}")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue