MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / get_image

Function get_image

bmtools/tools/office/ppt/api.py:67–75  ·  view source on GitHub ↗

get_image(keywords:str) -> str Get an image given comma separated keywords, return the image path.

(keywords:str)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 1

_return_timestampFunction · 0.85

Tested by

no test coverage detected