P01yH3dr0n commited on
Commit
cf5a805
1 Parent(s): 8bf6fc3

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +7 -6
utils.py CHANGED
@@ -44,7 +44,10 @@ def generate_novelai_image(
44
  ref_str=0.6,
45
  i2i_image=None,
46
  i2i_str=0.7,
47
- i2i_noise=0
 
 
 
48
  ):
49
  # Assign a random seed if seed is -1
50
  if seed == -1:
@@ -80,20 +83,18 @@ def generate_novelai_image(
80
  "sm": smea,
81
  "sm_dyn": dyn,
82
  "uncond_scale": 1,
 
83
  }
84
  }
85
  if ref_image is not None:
86
  payload['parameters']['reference_image'] = image2base64(ref_image)
87
- '''
88
- if use_inp:
89
  payload['action'] = "infill"
90
  payload['model'] = 'nai-diffusion-3-inpainting'
91
  payload['parameters']['mask'] = image2base64(inp_img['layers'][0])
92
  payload['parameters']['image'] = image2base64(inp_img['background'])
93
  payload['parameters']['extra_noise_seed'] = seed
94
- payload['parameters']['strength'] = inp_str
95
- '''
96
- if i2i_image is not None:
97
  payload['action'] = "img2img"
98
  payload['parameters']['image'] = image2base64(i2i_image)
99
  payload['parameters']['strength'] = i2i_str
 
44
  ref_str=0.6,
45
  i2i_image=None,
46
  i2i_str=0.7,
47
+ i2i_noise=0,
48
+ overlay=True,
49
+ inp_img=None,
50
+ selection='i2i'
51
  ):
52
  # Assign a random seed if seed is -1
53
  if seed == -1:
 
83
  "sm": smea,
84
  "sm_dyn": dyn,
85
  "uncond_scale": 1,
86
+ "overlay": True
87
  }
88
  }
89
  if ref_image is not None:
90
  payload['parameters']['reference_image'] = image2base64(ref_image)
91
+ if selection == 'inp' and inp_img is not None:
 
92
  payload['action'] = "infill"
93
  payload['model'] = 'nai-diffusion-3-inpainting'
94
  payload['parameters']['mask'] = image2base64(inp_img['layers'][0])
95
  payload['parameters']['image'] = image2base64(inp_img['background'])
96
  payload['parameters']['extra_noise_seed'] = seed
97
+ if i2i_image is not None and selection == 'i2i':
 
 
98
  payload['action'] = "img2img"
99
  payload['parameters']['image'] = image2base64(i2i_image)
100
  payload['parameters']['strength'] = i2i_str