Generate an image.
(query : str)
| 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 |
nothing calls this directly
no test coverage detected