【深度学习】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"])
相关推荐
知白守黑V36 分钟前
从ChatGPT到代理AI:安全领域的新变革
人工智能·安全·生成对抗网络·网络安全·chatgpt·安全威胁分析·ai数据安全
IRevers1 小时前
使用Python和Pybind11调用C++程序(CMake编译)
开发语言·c++·人工智能·python·深度学习
不灭蚊香1 小时前
Faster R-CNN (目标检测)
深度学习·神经网络·目标检测·cnn·faster r-cnn
学不会lostfound1 小时前
三、计算机视觉_08YOLO目标检测
人工智能·深度学习·yolo·计算机视觉·检测任务
weixin_431470861 小时前
人名分类器(nlp)
人工智能·pytorch·python·深度学习·自然语言处理
小馒头学python3 小时前
深度学习中的卷积神经网络:原理、结构与应用
人工智能·深度学习·cnn
2zcode3 小时前
基于YOLOv8深度学习的脑肿瘤智能检测系统设计与实现(PyQt5界面+数据集+训练代码)
人工智能·深度学习·yolo
m0_742848883 小时前
PyTorch3
人工智能·深度学习
仙俊红4 小时前
快速运行openMMOCR
深度学习·算法
Guofu_Liao4 小时前
大语言模型---Llama不同系列的权重参数文件提取;Llama-7B权重文件提取;Llama-8B权重文件提取;主要代码功能解析
人工智能·语言模型·自然语言处理·chatgpt·aigc·llama·python3.11