当前位置:   article > 正文

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

【深度学习】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
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

如何让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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/149485?site
推荐阅读
相关标签
  

闽ICP备14008679号