massimo ceraolo commited on
Commit
72d6ba3
·
1 Parent(s): 70d397f

change parameters for more realism

Browse files
Files changed (1) hide show
  1. inference.py +8 -9
inference.py CHANGED
@@ -186,14 +186,10 @@ def find_similar_ikea_products(image_input, index, metadata_df, top_k=5, process
186
  return results
187
 
188
 
189
- def generate_image(prompt, control_image, guidance_scale, output_quality, negative_prompt, control_strength):
190
  logging.info("\nGenerating image with Stable Diffusion...")
191
  logging.info(f"Prompt: {prompt}")
192
- guidance_scale = 2.5
193
- output_quality = 100
194
- negative_prompt = "low quality, ugly, distorted, artefacts"
195
- control_strength = 0.45
196
- # Modify the input handling to work with file paths
197
  if isinstance(control_image, str):
198
  image = open(control_image, "rb")
199
  else:
@@ -205,7 +201,9 @@ def generate_image(prompt, control_image, guidance_scale, output_quality, negati
205
  "guidance_scale": guidance_scale,
206
  "output_quality": output_quality,
207
  "negative_prompt": negative_prompt,
208
- "control_strength": control_strength
 
 
209
  }
210
 
211
  logging.info("Running image generation model...")
@@ -222,7 +220,6 @@ def generate_image(prompt, control_image, guidance_scale, output_quality, negati
222
 
223
  # step 2
224
 
225
-
226
  def analyze_image(image_path):
227
  logging.info(f"\nAnalyzing image with GPT-4V: {image_path}")
228
 
@@ -327,7 +324,9 @@ def main(prompt, control_image, index, metadata_df):
327
  guidance_scale=2.5,
328
  output_quality=100,
329
  negative_prompt="low quality, ugly, distorted, artefacts",
330
- control_strength=0.95
 
 
331
  )
332
  results['generated_images'] = generated_images
333
  results['generated_image_path'] = "output_0.jpg"
 
186
  return results
187
 
188
 
189
+ def generate_image(prompt, control_image, guidance_scale, output_quality, negative_prompt, control_strength, image_to_image_strength, control_type):
190
  logging.info("\nGenerating image with Stable Diffusion...")
191
  logging.info(f"Prompt: {prompt}")
192
+
 
 
 
 
193
  if isinstance(control_image, str):
194
  image = open(control_image, "rb")
195
  else:
 
201
  "guidance_scale": guidance_scale,
202
  "output_quality": output_quality,
203
  "negative_prompt": negative_prompt,
204
+ "control_strength": control_strength,
205
+ "image_to_image_strength": image_to_image_strength,
206
+ "control_type": control_type
207
  }
208
 
209
  logging.info("Running image generation model...")
 
220
 
221
  # step 2
222
 
 
223
  def analyze_image(image_path):
224
  logging.info(f"\nAnalyzing image with GPT-4V: {image_path}")
225
 
 
324
  guidance_scale=2.5,
325
  output_quality=100,
326
  negative_prompt="low quality, ugly, distorted, artefacts",
327
+ control_strength=0.5,
328
+ image_to_image_strength=0.1,
329
+ control_type="canny"
330
  )
331
  results['generated_images'] = generated_images
332
  results['generated_image_path'] = "output_0.jpg"