Skip to content

Instantly share code, notes, and snippets.

@bddppq
Created November 1, 2023 05:45
Show Gist options
  • Save bddppq/afd31d52f34c3974ee7779e6fd746a93 to your computer and use it in GitHub Desktop.
Save bddppq/afd31d52f34c3974ee7779e6fd746a93 to your computer and use it in GitHub Desktop.
txt2img
import requests
url = "https://k9knkoi0-sdfarm.bjz.edr.lepton.ai/txt2img"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
}
MODEL_MAP = {
"majicMIX realistic": "126470",
"Counterfeit": "57618",
"XXMixUnreal": "130273",
# "RealCartoon3D": "198698",
}
json = {
"model": "126470", # see MODEL_MAP above
"prompt": "1girl,smirk,curly hair,in the dark,deep shadow",
"negative_prompt": "(worst quality:2),(low quality:2),(normal quality:2),lowres,watermark,badhandv4,ng_deepnegative_v1_75t,",
"steps": 20,
"cfg_scale": 6,
"clip_skip": 2,
"seed": 4241197616,
"sampler": "Euler",
"width": 512,
"height": 768,
}
res = requests.post(url, headers=headers, json=json)
with open("out.png", "wb") as f:
f.write(res.content)
#### LORA
# use <lora:{model_version_id}:multiplier> to use lora, e.g. <lora:125985:1>
LORA_MAP = {
"cyberworld": "102139",
"GHIBLI_Background": "125985",
"Niji COOL perfect anime": "142924",
"Genshin Impact All In One": "116970",
}
json = {
"model": "130273", # see MODEL_MAP above
"prompt": "(style of studio ghibli:1.2), (masterpiece, best quality), 1girl and totoro, totoro bus stop, <lora:125985:1>",
"negative_prompt": "(worst quality:2), (bad quality:2), (normal quality:2), lowers, bad anatomy, bad hands, (multiple views),",
"sampler": "DPM++ SDE Karras",
"steps": 40,
"cfg_scale": 8,
"clip_skip": 2,
"seed": 963792948,
"width": 512,
"height": 512,
}
res = requests.post(url, headers=headers, json=json)
with open("out_lora.png", "wb") as f:
f.write(res.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment