LPX55 commited on
Commit
2f7594c
·
1 Parent(s): e06a6fd
Files changed (2) hide show
  1. app_v3.py +1 -2
  2. debug.py +6 -3
app_v3.py CHANGED
@@ -70,7 +70,7 @@ def generate_image(prompt, scale, steps, control_image, controlnet_conditioning_
70
  control_guidance_start=0.0,
71
  control_guidance_end=guidance_end,
72
  ).images[0]
73
- print("Type: " + str(type(image)))
74
  return image
75
 
76
  def combine_caption_focus(caption, focus):
@@ -108,7 +108,6 @@ def process_image(control_image, user_prompt, system_prompt, scale, steps,
108
  guidance_end, temperature, top_p, max_new_tokens, log_prompt):
109
  # Initialize with empty caption
110
  final_prompt = user_prompt.strip()
111
- print("User generated prompt: " + final_prompt)
112
  # If no user prompt provided, generate a caption first
113
  if not final_prompt:
114
  # Generate a detailed caption
 
70
  control_guidance_start=0.0,
71
  control_guidance_end=guidance_end,
72
  ).images[0]
73
+ # print("Type: " + str(type(image)))
74
  return image
75
 
76
  def combine_caption_focus(caption, focus):
 
108
  guidance_end, temperature, top_p, max_new_tokens, log_prompt):
109
  # Initialize with empty caption
110
  final_prompt = user_prompt.strip()
 
111
  # If no user prompt provided, generate a caption first
112
  if not final_prompt:
113
  # Generate a detailed caption
debug.py CHANGED
@@ -33,13 +33,16 @@ def save_image(image_id, image_path: Image.Image) -> None:
33
  print("Image ID: " + image_id)
34
  print("Image ID Type: " + str(type(image_id)))
35
  save_image_path = os.path.join(IMAGE_DIR, f"{image_id}.png")
 
36
  with scheduler.lock:
37
  try:
38
  # print("Image path: " + image_path)
39
  print("Type: " + str(type(image_path)))
40
- commit_image = Image.open(image_path)
41
- commit_image = commit_image.convert("P", palette=Image.ADAPTIVE, colors=256)
42
- commit_image.save(save_image_path)
 
 
43
  print(f"Saved image: {save_image_path}")
44
  except Exception as e:
45
  print(f"Error saving image: {str(e)}")
 
33
  print("Image ID: " + image_id)
34
  print("Image ID Type: " + str(type(image_id)))
35
  save_image_path = os.path.join(IMAGE_DIR, f"{image_id}.png")
36
+ print("Save image path: " + save_image_path)
37
  with scheduler.lock:
38
  try:
39
  # print("Image path: " + image_path)
40
  print("Type: " + str(type(image_path)))
41
+ with Image.open(save_image_path) as img:
42
+ img = Image.open(image_path)
43
+ img = img.convert("P", palette=Image.ADAPTIVE, colors=256)
44
+ img.save(save_image_path)
45
+
46
  print(f"Saved image: {save_image_path}")
47
  except Exception as e:
48
  print(f"Error saving image: {str(e)}")