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