image returns as base64
I'm using the SD Anything v5 model.
when im making a api call (RUNSYNC/RUN) im getting the image in a base64 text.
How do i get it to return a link to the image?
my only header except authorization is
Content-Type: application/json
11 Replies
What are you using to recieve the request?
Python?
Postman?
FOR PYTHON
pip install pillow
import base64
from PIL import Image
from io import BytesIO
def base64_to_image(base64_string, save_path='output_image.png'):
try:
# Decode Base64 string
image_data = base64.b64decode(base64_string)
# Create a PIL Image object from the decoded data
image = Image.open(BytesIO(image_data))
# Save the image (optional)
image.save(save_path)
# Display the image (optional)
image.show()
return image
except Exception as e:
print(f"Error converting Base64 to image: {e}")
return None
# Example usage:
base64_string = "Your_Base64_Encoded_String_Goes_Here"
image = base64_to_image(base64_string)
Base64 to Image | Base64 Decode | Base64 Converter | Base64
Convert Base64 to image online using a free decoding tool
I mean,
I saw in the examples in the API documentation that it returns a link to the image and I would prefer that from base64 image.
I'm using insomnia
You can provide s3 compatible storage credentials if you are using RunPod endpoints, otherwise if you're using your own custom handler, you have to handle it yourself.
eg:
ok great!
do you know if the runpod storage is and if yes where to find all the values?
RunPod don't provide S3 compatible storage, you will have to use AWS/DigitalOcean/Backblaze/R2/etc/etc.
ok good to know
thx a bunch
Any easy place to start is the Firebase API
https://github.com/justinwlin/FirebaseStorageWrapperPython
At least to me
GitHub
GitHub - justinwlin/FirebaseStorageWrapperPython: Easy wrapper arou...
Easy wrapper around Firebase File Storage Wrapper in Python - GitHub - justinwlin/FirebaseStorageWrapperPython: Easy wrapper around Firebase File Storage Wrapper in Python
I have a firebase storage wrapper, where I use firebase file storage (which is just a wrapper from Google around Google storage buckets)
And I can when i upload get public links
Is it s3 compatible? if not, it can't work with RunPod official endpoints.
AH makes sense
i was thinking was custom handler
oops
makes sense now tho got it