图像与设计
通过 inference.sh CLI 调用 Google…
在安装并登录 inference.sh CLI(belt)后,用命令行或 Python SDK 进行文生图、图像编辑、多图输入、4K 输出和 Google Search grounding。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 59/100 ×0.15
适用场景
通过 inference.sh CLI 特定
解决思路
- 安装 belt CLI 技能:运行 `npx skills add belt-sh/cli`。
- 安装 inference.sh CLI(`belt`),安装说明见 `https://raw.githubusercontent.com/inference-sh/skills/refs/heads/main/cli-install.md`。
- 登录 inference.sh:运行 `belt login`。
- 基础文生图:运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "a banana in space, photorealistic"}'`。
- 示例:基础文生图,运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "A futuristic cityscape at sunset with flying cars"}'`。
- 示例:生成多张图像,在 `--input` JSON 中设置 `"num_images": 4`,例如运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "Minimalist logo design for a coffee shop", "num_images": 4}'`。
- 示例:自定义宽高比,在 `--input` JSON 中设置 `"aspect_ratio": "16:9"`,例如运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "Panoramic mountain landscape with northern lights", "aspect_ratio": "16:9"}'`。
- 示例:图像编辑,在 `--input` JSON 中传入 `"images": ["https://example.com/landscape.jpg"]` 并给出修改 prompt,例如运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "Add a rainbow in the sky", "images": ["https://example.com/landscape.jpg"]}'`。
- 示例:高分辨率 4K,在 `--input` JSON 中设置 `"resolution": "4K"`,例如运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "Detailed illustration of a medieval castle", "resolution": "4K"}'`。
- 示例:启用 Google Search grounding,在 `--input` JSON 中设置 `"enable_google_search": true`,例如运行 `belt app run google/gemini-3-1-flash-image --input '{"prompt": "Current weather in Tokyo visualized as an artistic scene", "enable_google_search": true}'`。
- 输入参数 `prompt`:字符串,必填,描述要生成或修改的内容。
- 输入参数 `images`:数组,用于编辑的输入图像,最多 14 张,支持 JPEG、PNG、WebP。
- 输入参数 `num_images`:整数,要生成的图像数量。
- 输入参数 `aspect_ratio`:字符串,输出比例,可选 `"1:1"`、`"16:9"`、`"9:16"`、`"4:3"`、`"3:4"`、`"auto"`。
- 输入参数 `resolution`:字符串,可选 `"1K"`、`"2K"`、`"4K"`,默认 `"1K"`。
- 输入参数 `output_format`:字符串,设置图像输出格式。
- 输入参数 `enable_google_search`:布尔值,启用实时信息 grounding,例如天气、新闻等。
- 输出字段 `images`:数组,生成或编辑后的图像。
- 输出字段 `description`:字符串,模型返回的文本描述或响应。
- 输出字段 `output_meta`:对象,输入/输出元数据,用于计费。
- Prompt 技巧:风格可使用 `photorealistic`、`illustration`、`watercolor`、`oil painting`、`digital art`、`anime`、`3D render`。
- Prompt 技巧:构图可使用 `close-up`、`wide shot`、`aerial view`、`macro`、`portrait`、`landscape`。
- Prompt 技巧:光照可使用 `natural light`、`studio lighting`、`golden hour`、`dramatic shadows`、`neon`。
- Prompt 技巧:添加关于纹理、颜色、心情、氛围的具体细节。
- 示例工作流第 1 步:运行 `belt app sample google/gemini-3-1-flash-image --save input.json` 生成包含所有选项的示例输入。
- 示例工作流第 2 步:编辑 prompt。
- 示例工作流第 3 步:运行 `belt app run google/gemini-3-1-flash-image --input input.json`。
- Python SDK:导入并创建客户端:`from inferencesh import inference` 和 `client = inference()`。
- Python SDK 基础生成:调用 `result = client.run({"app": "google/gemini-3-1-flash-image@0c7ma1ex", "input": {"prompt": "A banana in space, photorealistic"}})`,然后 `print(result["output"])`。
- Python SDK 流式实时更新:调用 `client.run({"app": "google/gemini-3-1-flash-image@0c7ma1ex", "input": {"prompt": "A futuristic cityscape at sunset"}}, stream=True)`,遍历更新,若存在 `progress` 则打印 `progress: {update['progress']}%`,若存在 `output` 则打印 `output: {update['output']}`。
- 相关技能:安装原始 Nano Banana:运行 `npx skills add inference-sh/skills@nano-banana`。
- 相关技能:安装完整平台技能(所有 apps):运行 `npx skills add inference-sh/skills@infsh-cli`。
- 相关技能:安装所有图像生成模型:运行 `npx skills add inference-sh/skills@ai-image-generation`。
- 浏览所有图像应用:运行 `belt app list --category image`。
- 参考文档:运行 Apps 见 `https://inference.sh/docs/apps/running`。
- 参考文档:流式结果见 `https://inference.sh/docs/api/sdk/streaming`。
- 参考文档:文件处理见 `https://inference.sh/docs/api/sdk/files`。
适用边界 · 注意事项
- 未安装或无法使用 inference.sh CLI(`belt`)、没有 inference.sh 账号或付费访问时不适用。
- 需要完全本地、离线、不依赖云服务生成图像时不适用。
- 只需要非 Google Gemini 3.1 Flash Image Preview / Nano Banana 2 的图像生成模型时不必用本技能。