【深度学习】Gemini 1.0 Pro 如何让chatGPT扮演stable diffusion的提示词工程师

news/2024/7/10 22:04:56 标签: 深度学习, chatgpt, stable diffusion

google也出了一个chatGPT,免费申请使用:
https://aistudio.google.com/app/prompts/new_chat

https://github.com/google/generative-ai-docs/blob/main/site/en/tutorials/rest_quickstart.ipynb

模型信息:

$ curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro?key=AIzaSyAho-miIORxjCtlbuOkXsqsJ8Fmi8
{
  "name": "models/gemini-pro",
  "version": "001",
  "displayName": "Gemini 1.0 Pro",
  "description": "The best model for scaling across a wide range of tasks",
  "inputTokenLimit": 30720,
  "outputTokenLimit": 2048,
  "supportedGenerationMethods": [
    "generateContent",
    "countTokens"
  ],
  "temperature": 0.9,
  "topP": 1,
  "topK": 1
}

如何让chatGPT扮演stable diffusion的提示词工程师?

使用这个代码:

import requests
import os

# 10.197.35.149:10810
os.environ["http_proxy"] = "http://10.197.35.149:10811"
os.environ["https_proxy"] = "http://10.197.35.149:10811"

url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=AIzaSyAho-miIORxjCtlbuAYwukXsqsJ8Fmi8"

payload = {
    "contents": [
        {
            "role": "user",
            "parts": [{"text": """从现在开始你将扮演一个stable diffusion的提示词工程师,你的任务是帮助我设计stable diffusion的文生图提示词。你需要按照如下流程完成工作。1、我将给你发送一段图片情景,你需要将这段图片情景更加丰富和具象生成一段图片描述。并且按照“【图片内容】具像化的图片描述”格式输出出来;2、你需要结合stable diffusion的提示词规则,将你输出的图片描述翻译为英语,并且加入诸如高清图片、高质量图片等描述词来生成标准的提示词,提示词为英语,以“【正向提示】提示词”格式输出出来;3、你需要根据上面的内容,设计反向提示词,你应该设计一些不应该在图片中出现的元素,例如低质量内容、多余的鼻子、多余的手等描述,这个描述用英文并且生成一个标准的stable diffusion提示词,以“【反向提示】提示词”格式输出出来。4、你需要提示我在生成图片时需要设置的参数以及给我推荐一个使用的模型以及生成这张图片的最优长宽比例,按照“【参数】Sampling method:参数;Sampling steps:参数;CFG Scale:参数;Seed:参数;最优长宽比:参数”的格式输出给我,其中需要注意的是Sampling method参数请在如下列表中选择“Euler a,Euler,LMS,Heun,DPM2,DPM2a,DPM++ 25 a,DPM++ 2M,DPM++ SDE,DPM fast,DPM adaptive,LMS Karras,DPM2 Karras,DPM2 a Karras,DPM++ 2S a Karras,DPM++ 2M Karras,DPM++ SDE Karras,DDIM,PLIMS,UniPC)”。例如:我发送:一个二战时期的护士。你回复:
【图片内容】一个穿着二战期间德国护士服的护士,手里拿着一个酒瓶,带着听诊器坐在附近的桌子上,衣服是白色的,背后有桌子。
【正向提示】A nurse wearing a German nurse's uniform during World War II, holding a wine bottle and a stethoscope, sat on a nearby table with white clothes and a table behind,full shot body photo of the most beautiful artwork in the world featuring ww2 nurse holding a liquor bottle sitting on a desk nearby, smiling, freckles, white outfit, nostalgia, sexy, stethoscope, heart professional majestic oil painting by Ed Blinkey, Atey Ghailan, Studio Ghibli, by Jeremy Mann, Greg Manchess, Antonio Moro, trending on ArtStation, trending on CGSociety, Intricate, High Detail, Sharp focus, dramatic, photorealistic painting art by midjourney and greg rutkowski;【反向提示】cartoon, 3d, ((disfigured)), ((bad art)), ((deformed)),((extra limbs)),((close up)),((b&w)), wierd colors, blurry, (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck))), Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, blurry, bad art, bad anatomy, 3d rende;
【参数】Sampling method:DPM++ 2M Karras;Sampling steps:20;CFG Scale:7;Seed:639249185;最优长宽比:3:4 现在我的第一个图片场景如下:一个海边抽烟的男人"""}]
        },
        {
            "role": "model",
            "parts": [{"text": """【图片内容】一个穿着黑色夹克和牛仔裤的男人,戴着黑色帽子和太阳镜,右手拿着一支香烟,左手插在裤兜里,站在海滩上,背景是蓝天和海浪。

【正向提示】A man wearing a black jacket and jeans, with a black hat and sunglasses, holding a cigarette in his right hand and his left hand in his pocket, standing on the beach with blue skies and sea waves in the background. High-quality photo of a rugged man enjoying a smoke break by the sea, capturing the sense of freedom and relaxation. Shot in high definition, this image is perfect for any project that requires a cool and laid-back vibe.

【反向提示】blurred, low quality, pixelated, (unattractive), (grimy), (old man), (dark), (out of focus), (unclear), (dirty), ((extra arm)), ((extra leg)), ((extra nose)), ((extra mouth)), (out of frame), (bad composition), (too bright), (too dark), ((extra cigarette)), ((extra hand)), (poor lighting), (bad color grading), (red-eyed), (morphed face), (unnatural posture), (awkward pose), (frozen animation), (poorly photoshopped), (low-res), (bad framing), (insipid)

【参数】Sampling method: Euler; Sampling steps: 20; CFG Scale: 6; Seed: 83592794; 最优长宽比: 16:9"""}]
        },
        {
            "role": "user",
            "parts": [{"text": "一只小青蛙"}]
        }
    ],
    "generationConfig": {
        # "stopSequences": [
        #     "Title"
        # ],
        "temperature": 0.9,
        "maxOutputTokens": 800,
        "topP": 0.8,
        "topK": 10
    }
}

headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json()["candidates"][0]["content"]["parts"][0]["text"])

http://www.niftyadmin.cn/n/5387894.html

相关文章

Window部署SkyWalking

SkyWalking mysql的驱动依赖 选择下载版本 v9.4 现在后解压缩目录结构 一、修改config目录文件 application.yml 修改1: selector: ${SW_STORAGE:h2} 修改后: selector: ${SW_STORAGE:mysql} 修改2:使用mysql数据库 mysql: properti…

数据结构与算法之美学习笔记:53 | 算法实战(二):剖析搜索引擎背后的经典数据结构和算法

目录 前言整体系统介绍搜集1. 待爬取网页链接文件:links.bin2. 网页判重文件:bloom_filter.bin3. 原始网页存储文件:doc_raw.bin4. 网页链接及其编号的对应文件:doc_id.bin 分析索引查询总结引申 前言 本节课程思维导图&#xff1…

中级.NET开发工程师面试经历

文章目录 前言面试题目(只记录了还记得的部分)一.简单说下.NETCORE的生命周期?二.C#如何保证在并发情况下接口不会被重复触发?三.引用类型和值类型有什么区别?四.那怎样能让引用类型和值类型一样,在赋值的时…

SpringCloud(15)之SpringCloud Gateway

一、Spring Cloud Gateway介绍 Spring Cloud Gateway 是Spring Cloud团队的一个全新项目,基于Spring 5.0、SpringBoot2.0、 Project Reactor 等技术开发的网关。旨在为微服务架构提供一种简单有效统一的API路由管理方式。 Spring Cloud Gateway 作为SpringCloud生态…

sentinel中监听器的运用--规则管理

sentinel中监听器的运用–规则管理 规则结构 类图关系 类关系图如下 Rule 将规则抽象成一个类, 规则与资源是紧密关联的, 也就是说规则作用于资源。因此, 我们需要将规则表示为一个类, 并包含一个获取资源的方法 这里采用接口的原因就是规则是一个抽象概念而非具体实现。…

JimuReport积木报表 v1.7.0 变革版本发布,低代码报表设计工具

项目介绍 一款免费的数据可视化报表,含报表和大屏设计,像搭建积木一样在线设计报表!功能涵盖,数据报表、打印设计、图表报表、大屏设计等! Web 版报表设计器,类似于excel操作风格,通过拖拽完成报…

Android 广播的基本概念

一.广播简介 Broadcast是安卓四大组件之一。安卓为了方便进行系统级别的消息通知,引入了一套广播消息机制。打个比方,记得原来在上课的时候,每个班级的教室里都会装有一个喇叭,这些喇叭都是接入到学校的广播室的,一旦…

重磅!MongoDB推出Atlas Stream Processing公共预览版

日前,MongoDB宣布推出Atlas Stream Processing公共预览版。 在Atlas平台上有兴趣尝试这项功能的开发者都享有完全的访问权限,可前往“阅读原文”链接点击了解更多详细信息或立即开始使用。 开发者喜欢文档型数据库的灵活性、易用性以及Query API查询方…