agentbot commited on
Commit
9f6350c
·
verified ·
1 Parent(s): 2932f80

Initial commit with folder contents

Browse files
Files changed (1) hide show
  1. src/pipeline.py +7 -5
src/pipeline.py CHANGED
@@ -95,9 +95,11 @@ def max_pixel_filter(image: Image) -> Image:
95
  # Convert the image to a numpy array
96
  img_array = np.array(image)
97
  # Find the maximum pixel value in the image
98
- max_val = img_array.max()
 
 
99
  # Reduce the maximum value to 1
100
- img_array[img_array == max_val] -= 2
101
  # Convert the numpy array back to an image
102
  filtered_image = Image.fromarray(img_array)
103
  return filtered_image
@@ -956,8 +958,8 @@ def load_pipeline(pipeline=None) -> StableDiffusionXLPipeline:
956
  # Warm-up runs
957
  for _ in range(4):
958
  pipeline(
959
- prompt="a cat and a dog",
960
- num_inference_steps=18
961
  )
962
  pipeline.scheduler.prepare_loss()
963
  return pipeline
@@ -973,7 +975,7 @@ def infer(request: TextToImageRequest, pipeline: StableDiffusionXLPipeline) -> I
973
  width=request.width,
974
  height=request.height,
975
  generator=generator,
976
- num_inference_steps=18,
977
  ).images[0]
978
 
979
  filter_image = max_pixel_filter(image_0)
 
95
  # Convert the image to a numpy array
96
  img_array = np.array(image)
97
  # Find the maximum pixel value in the image
98
+ # max_val = img_array.max()
99
+ max_val = img_array.min()
100
+
101
  # Reduce the maximum value to 1
102
+ img_array[img_array == max_val] += 1
103
  # Convert the numpy array back to an image
104
  filtered_image = Image.fromarray(img_array)
105
  return filtered_image
 
958
  # Warm-up runs
959
  for _ in range(4):
960
  pipeline(
961
+ prompt="a girl and a woman",
962
+ num_inference_steps=14
963
  )
964
  pipeline.scheduler.prepare_loss()
965
  return pipeline
 
975
  width=request.width,
976
  height=request.height,
977
  generator=generator,
978
+ num_inference_steps=14,
979
  ).images[0]
980
 
981
  filter_image = max_pixel_filter(image_0)