Spaces:
Sleeping
Sleeping
Download llm_api/utils.py from creativeforce/attribution: direct link, hf CLI and curl.
- Browser
- Download file 335 Bytes
-
https://huggingface.co/spaces/creativeforce/attribution/resolve/main/llm_api/utils.py
- Command line
-
hf download hf://spaces/creativeforce/attribution/llm_api/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/creativeforce/attribution/resolve/main/llm_api/utils.py
335 Bytes
| import base64 | |
| def get_image_data(image_path): | |
| with open(image_path, "rb") as f: | |
| image_data = base64.b64encode(f.read()).decode("utf-8") | |
| return image_data | |
| def get_data_format(image_path): | |
| image_format = image_path.split(".")[-1] | |
| if image_format == "jpg": | |
| image_format = "jpeg" | |
| return image_format |