Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
liuzx d8f52c3f64 | 4 months ago | |
---|---|---|
.gitignore | 6 months ago | |
README.md | 5 months ago | |
checkpoint_api.py | 4 months ago | |
checkpoint_webui.py | 4 months ago | |
generate.py | 4 months ago | |
lora_api.py | 5 months ago | |
sd3_api.py | 4 months ago | |
sd3_webui.py | 4 months ago |
此项目提供stable-diffusion的api请求示例,用于stable-diffusion-xl的在线推理。
在启智AI协作平台上,在线体验的路径:
模型-大模型基地-计算机视觉模型-Stable Diffusion
新建调试任务时选择以下参数:
模型:可选择一个sd xl模型,如stable-diffusion-xl-base-1.0
资源规格:1 * V100
镜像:192.168.242.22:443/default-workspace/2a72307689ae49758c80c896fffda0a1/image:stable-diffusion-api-webui-v3
进入调试环境后,修改checkpoint_api.py里的对外端口为8000:
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
使用终端运行:python checkpoint_api.py
使用命令行发送api请求示例,生成的图片放在/tmp/code目录下:
curl -X POST http://0.0.0.0:8000/${OCTOPUS_NOTEBOOK_BASE_URL}/text2image -H "Content-Type: application/json" -d '{"prompt": "Girl, long straight brown hair with bangs, blue eyes, looks at the viewer, blush, dressed in a black coat, wears a black backpack on her back, flowing hair, wind, stands outside in the snow, snow, winter, snow is falling, blizzard, hands in pockets, its light outside, no sun, cloudy, pastel colors, in detail", "negative_prompt": "low quality,jpeg artifacts,blurry,poorly drawn,ugly,worst quality"}'
新建在线推理任务时选择以下参数:
模型:可选择一个sd xl模型,如stable-diffusion-xl-base-1.0
资源规格:1 * V100
镜像:192.168.242.22:443/default-workspace/2a72307689ae49758c80c896fffda0a1/image:stable-diffusion-api-webui-v3
启动文件:checkpoint_api.py
任务运行后,点击在线推理可查看api服务地址:
将推理地址最后面的 ?token 替换成 /text2image ,即为api接口地址,例如 https://mlunotebook.openi.org.cn/notebook_bff8721d68354db881d82a34c984dd6d_task0/text2image
以下是推荐的sd xl模型,只选一个,可先收藏此模型再选用:
stable-diffusion-xl-base-1.0 或 leosamsHelloworldXL_helloworldXL60 或 AAM_XL_AnimeMix
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》