https://www.boundaryml.com logo
Reading image from absolute path
# help
c
Hi, I have a code as below:
Copy code
from baml_py import Image  

img = Image.from_url(f.absolute().as_posix())  
content = b.DescribeMedia(img)
When i read the image i get an error at `content = b.DescribeMedia(img)`:
Copy code
baml_py.internal_monkeypatch.BamlValidationError: BamlValidationError(message=Internal Failure: Failed to fetch media: builder error

Caused by:
    relative URL without a base - Failed to fetch media: builder error

Caused by:
    relative URL without a base, raw_output=, prompt=N/A, detailed_message=Parsing error: Internal Failure: Failed to fetch media: builder error

Caused by:
    relative URL without a base - Failed to fetch media: builder error

Caused by:
    relative URL without a base
Prompt: N/A
Raw Response: )
It is an absolute path to the file. The test case below works fine :
Copy code
test Test {
  functions [DescribeMedia]
  args {
    img {
      file "<ABSOLUTE_PATH>"
    }
  }
}
v
.as_url only accepts actual urls, for files loaded in python you must read them and pass them using ⁨`.as_base64`⁩