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

Function generate_image

bmtools/tools/image_generation/api.py:107–124  ·  view source on GitHub ↗

Generate an image.

(query : str)

Source from the content-addressed store, hash-verified

105
106 @tool.get("/generate_image")
107 def generate_image(query : str):
108 '''Generate an image.
109 '''
110 image_generator = steamship.use_plugin(
111 plugin_handle=model_name.value, config={"n": 1, "size": size}
112 )
113
114 task = image_generator.generate(text=query, append_output_to_file=True)
115 task.wait()
116 blocks = task.output.blocks
117 output_uiud = blocks[0].id
118 if len(blocks) > 0:
119 if return_urls:
120 output_uiud = make_image_public(steamship, blocks[0])
121 # print image?
122 # show_output(output_uiud)
123 return output_uiud
124 raise RuntimeError("Tool unable to generate image!")
125
126 return tool

Callers

nothing calls this directly

Calls 1

make_image_publicFunction · 0.85

Tested by

no test coverage detected