当前位置: 首页 > article >正文

fastGPT调用stable diffusion生成图片,本地模型使用ollama

ps:192.168.1.100换成你的ip

一、开器stable diffusion的api访问

Git上copy的项目,在启动web-ui.bat/sh时加上--api的启动参数.

/web-ui.bat --api

我这里使用的stabble-diffusion-docker构建的默认就开启了

http://192.168.1.100:7860/docs

二、FastGPT中调用stable diffusion

1、新建插件

2、修改http请求
①post请求地址
http://192.168.1.100:7860/sdapi/v1/txt2img
②body参数
{
  "prompt": "{{prompt}}",
  "negative_prompt": "nsfw, paintings, cartoon, anime, sketches, worst quality, low quality, normal quality, lowres, watermark, monochrome, grayscale, ugly, blurry, Tan skin, dark skin, black skin, skin spots, skin blemishes, age spot, glans, disabled, bad anatomy, amputation, bad proportions, twins, missing body, fused body, extra head, poorly drawn face, bad eyes, deformed eye, unclear eyes, cross-eyed, long neck, malformed limbs, extra limbs, extra arms, missing arms, bad tongue, strange fingers, mutated hands, missing hands, poorly drawn hands, extra hands, fused hands, connected hand, bad hands, missing fingers, extra fingers, 4 fingers, 3 fingers, deformed hands, extra legs, bad legs, many legs, more than two legs, bad feet, extra feets, badhandv4, easynegative, FastNegativeV2, negative_hand-neg,ng_deepnegative_v1_75t, verybadimagenegative_v1.3",
  "override_settings": {
    "sd_model_checkpoint": "dreamshaper_8.safetensors",
    "sd_vae": "vae-ft-mse-840000-ema-pruned.safetensors"
  },
  "seed": -1,
  "subseed": -1,
  "subseed_strength": 0,
  "seed_resize_from_h": -1,
  "seed_resize_from_w": -1,
  "batch_size": 1,
  "n_iter": 1,
  "steps": 50,
  "cfg_scale": 7,
  "width": 512,
  "height": 512,
  "restore_faces": false,
  "tiling": false,
  "do_not_save_samples": false,
  "do_not_save_grid": false,
  "eta": 0,
  "denoising_strength": 0,
  "s_min_uncond": 0,
  "s_churn": 0,
  "s_tmax": 0,
  "s_tmin": 0,
  "s_noise": 0,
  "override_settings_restore_afterwards": true,
  "refiner_switch_at": 0,
  "disable_extra_networks": false,
  "comments": {},
  "enable_hr": false,
  "firstphase_width": 0,
  "firstphase_height": 0,
  "hr_scale": 2,
  "hr_second_pass_steps": 0,
  "hr_resize_x": 0,
  "hr_resize_y": 0,
  "hr_prompt": "",
  "hr_negative_prompt": "",
  "sampler_index": "Euler",
  "script_args": [],
  "send_images": true,
  "save_images": true,
  "alwayson_scripts": {}
}

3、增加AI对话生成提示词

4、增加文本拼接和指定回复

5、总的流程图

注意:使用插件那个输出删除不掉,最好用流程

三、成功了

PS:调试接口(可以跳过)

1、使用apifox导入stable diffusion接口

项目设置->导入数据->新建数据源->立即导入

2、调试接口

{
  "prompt": "a little cute house",
  "negative_prompt": "nsfw, paintings, cartoon, anime, sketches, worst quality, low quality, normal quality, lowres, watermark, monochrome, grayscale, ugly, blurry, Tan skin, dark skin, black skin, skin spots, skin blemishes, age spot, glans, disabled, bad anatomy, amputation, bad proportions, twins, missing body, fused body, extra head, poorly drawn face, bad eyes, deformed eye, unclear eyes, cross-eyed, long neck, malformed limbs, extra limbs, extra arms, missing arms, bad tongue, strange fingers, mutated hands, missing hands, poorly drawn hands, extra hands, fused hands, connected hand, bad hands, missing fingers, extra fingers, 4 fingers, 3 fingers, deformed hands, extra legs, bad legs, many legs, more than two legs, bad feet, extra feets, badhandv4, easynegative, FastNegativeV2, negative_hand-neg,ng_deepnegative_v1_75t, verybadimagenegative_v1.3",
  "override_settings": {
    "sd_model_checkpoint": "dreamshaper_8.safetensors",
    "sd_vae": "vae-ft-mse-840000-ema-pruned.safetensors"
  },
  "seed": -1,
  "subseed": -1,
  "subseed_strength": 0,
  "seed_resize_from_h": -1,
  "seed_resize_from_w": -1,
  "batch_size": 1,
  "n_iter": 1,
  "steps": 50,
  "cfg_scale": 7,
  "width": 512,
  "height": 512,
  "restore_faces": false,
  "tiling": false,
  "do_not_save_samples": false,
  "do_not_save_grid": false,
  "eta": 0,
  "denoising_strength": 0,
  "s_min_uncond": 0,
  "s_churn": 0,
  "s_tmax": 0,
  "s_tmin": 0,
  "s_noise": 0,
  "override_settings_restore_afterwards": true,
  "refiner_switch_at": 0,
  "disable_extra_networks": false,
  "comments": {},
  "enable_hr": false,
  "firstphase_width": 0,
  "firstphase_height": 0,
  "hr_scale": 2,
  "hr_second_pass_steps": 0,
  "hr_resize_x": 0,
  "hr_resize_y": 0,
  "hr_prompt": "",
  "hr_negative_prompt": "",
  "sampler_index": "Euler",
  "script_args": [],
  "send_images": true,
  "save_images": true,
  "alwayson_scripts": {}
}


http://www.kler.cn/a/385159.html

相关文章:

  • 浏览器端直播推流实现——系统篇
  • ClassLoader加载类的原理
  • 丹摩征文活动|新手入门指南
  • 云端到本地:深度学习日志与模型文件一键传输【详解 SCP 命令】
  • GitHub每日最火火火项目(11.8)
  • 微服务系列六:分布式事务与seata
  • DNS域名详细解析详解
  • 让零售更智能|无人超市系统开发,实现数字化商超
  • 【安当产品应用案例100集】029-使用安全芯片保护设备核心业务逻辑
  • _处理匿名命名空间里的变量时进入硬件中断错误
  • [全网最完整最详细C++篇]第四篇:类和对象(上)
  • YOLOv6-4.0部分代码阅读笔记-figure_iou.py
  • LabVIEW高效数据采集与信号处理系统
  • 【UE5】在材质中实现球形法线技术,常用于改善植物等表面的渲染效果
  • STM32CUBEIDE FreeRTOS操作教程(八):queues多队列
  • Altium Designer使用技巧(四)
  • 3193. 统计逆序对的数目
  • [JAVAEE] 网络基础
  • 气象监测软件的程序设计
  • 富格林:安全步骤交易稳健出金
  • sql-Incorrect string value
  • wordpress ripro-v5-8.3开心版主题源码
  • 操作系统学习笔记-5.1-IO设备
  • 使用BaGet快速搭建nuget服务
  • SQL,力扣题目1225,报告系统状态的连续日期【窗口函数】
  • 数据库Redis篇