【深度学习】Gemini 1.0 Pro 如何让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

模型信息:

python 复制代码
$ 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的提示词工程师?

使用这个代码:

python 复制代码
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"])
相关推荐
羊小猪~~27 分钟前
神经网络基础--什么是正向传播??什么是方向传播??
人工智能·pytorch·python·深度学习·神经网络·算法·机器学习
软工菜鸡1 小时前
预训练语言模型BERT——PaddleNLP中的预训练模型
大数据·人工智能·深度学习·算法·语言模型·自然语言处理·bert
哔哩哔哩技术2 小时前
B站S赛直播中的关键事件识别与应用
深度学习
deephub2 小时前
Tokenformer:基于参数标记化的高效可扩展Transformer架构
人工智能·python·深度学习·架构·transformer
___Dream2 小时前
【CTFN】基于耦合翻译融合网络的多模态情感分析的层次学习
人工智能·深度学习·机器学习·transformer·人机交互
极客代码2 小时前
【Python TensorFlow】入门到精通
开发语言·人工智能·python·深度学习·tensorflow
王哈哈^_^4 小时前
【数据集】【YOLO】【VOC】目标检测数据集,查找数据集,yolo目标检测算法详细实战训练步骤!
人工智能·深度学习·算法·yolo·目标检测·计算机视觉·pyqt
是瑶瑶子啦4 小时前
【深度学习】论文笔记:空间变换网络(Spatial Transformer Networks)
论文阅读·人工智能·深度学习·视觉检测·空间变换
wangyue45 小时前
c# 深度模型入门
深度学习
川石课堂软件测试5 小时前
性能测试|docker容器下搭建JMeter+Grafana+Influxdb监控可视化平台
运维·javascript·深度学习·jmeter·docker·容器·grafana