get_image(keywords:str) -> str Get an image given comma separated keywords, return the image path.
(keywords:str)
| 65 | |
| 66 | @tool.get("/get_image") |
| 67 | def get_image(keywords:str) -> str: |
| 68 | """get_image(keywords:str) -> str Get an image given comma separated keywords, return the image path. |
| 69 | """ |
| 70 | picture_url = IMAGE_BED_PATTERN.format(keywords) |
| 71 | response = requests.get(picture_url) |
| 72 | img_local_path = os.path.join(CACHE_DIR, f"{_return_timestamp()}.jpg") |
| 73 | with open(img_local_path, 'wb') as f: |
| 74 | f.write(response.content) |
| 75 | return img_local_path |
| 76 | |
| 77 | @tool.get("/add_first_page") |
| 78 | def add_first_page(title:str, subtitle:str) -> str: |
nothing calls this directly
no test coverage detected