Browse Source

working img2img upscale option

master
Hendrik Langer 2 years ago
parent
commit
dc9192f103
  1. 12
      matrix_pygmalion_bot/ai/runpod_pygmalion.py

12
matrix_pygmalion_bot/ai/runpod_pygmalion.py

@ -277,7 +277,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str)
# Make the request # Make the request
r = requests.post(endpoint, json=input_data, headers=headers) r = requests.post(endpoint, json=input_data, headers=headers)
r_json = r.json() r_json = r.json()
logger.info(r_json) logger.debug(r_json)
if r.status_code == 200: if r.status_code == 200:
status = r_json["status"] status = r_json["status"]
@ -292,7 +292,7 @@ async def serverless_automatic_request(payload, cmd, api_url: str, api_key: str)
endpoint = api_url + "status/" + job_id endpoint = api_url + "status/" + job_id
r = requests.get(endpoint, headers=headers) r = requests.get(endpoint, headers=headers)
r_json = r.json() r_json = r.json()
logger.info(r_json) logger.debug(r_json)
status = r_json["status"] status = r_json["status"]
if status == 'IN_PROGRESS': if status == 'IN_PROGRESS':
await asyncio.sleep(DELAY) await asyncio.sleep(DELAY)
@ -315,10 +315,14 @@ async def generate_image_automatic(input_prompt: str, negative_prompt: str, api_
payload = { payload = {
"prompt": input_prompt, "prompt": input_prompt,
"nagative_prompt": negative_prompt, "nagative_prompt": negative_prompt,
"steps": 20, "steps": 25,
"seed": -1, "seed": -1,
"width": 512, "width": 512,
"height": 768, "height": 768,
"batch_size": 3,
# "enable_hr": True,
# "hr_scale": 2,
# "hr_upscaler": "ESRGAN_4x",
"restore_faces": True, "restore_faces": True,
# "gfpgan_visibility": 0.5, # "gfpgan_visibility": 0.5,
# "codeformer_visibility": 0.5, # "codeformer_visibility": 0.5,
@ -335,7 +339,7 @@ async def generate_image_automatic(input_prompt: str, negative_prompt: str, api_
count = 0 count = 0
for i in output['images']: for i in output['images']:
payload = { payload = {
"images": [i], "init_images": [i],
"prompt": input_prompt, "prompt": input_prompt,
"nagative_prompt": negative_prompt, "nagative_prompt": negative_prompt,
"steps": 20, "steps": 20,

Loading…
Cancel
Save