【深度学习】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

模型信息:

$ 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"])

相关推荐

  1. 前端工程师常用ChatGPT通用提示模板

    2024-02-23 09:56:03       35 阅读
  2. 测试工程师常用ChatGPT通用提示模板

    2024-02-23 09:56:03       37 阅读
  3. 开发工程师常用ChatGPT通用提示模板

    2024-02-23 09:56:03       42 阅读
  4. 运维工程师常用ChatGPT通用提示模板

    2024-02-23 09:56:03       35 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-02-23 09:56:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-02-23 09:56:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-02-23 09:56:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-02-23 09:56:03       20 阅读

热门阅读

  1. 开源图表库Echarts 简介与基本使用

    2024-02-23 09:56:03       29 阅读
  2. gitlab 忘记root密码,修改root密码

    2024-02-23 09:56:03       25 阅读
  3. 前端简单复习

    2024-02-23 09:56:03       25 阅读
  4. docker 运行pgsql 命令

    2024-02-23 09:56:03       21 阅读
  5. 共享之力:分布式计算的奇迹

    2024-02-23 09:56:03       29 阅读
  6. 拉伸图片覆盖整个页面的css写法

    2024-02-23 09:56:03       32 阅读
  7. Ubuntu 22.04上编译Android 13 AOSP系统并刷入Pixel 6

    2024-02-23 09:56:03       34 阅读
  8. VUE API 接口

    2024-02-23 09:56:03       30 阅读