EmoCube commited on
Commit
e92be6e
·
verified ·
1 Parent(s): cbaffde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -40,6 +40,24 @@ def query(prompt, is_negative=False):
40
  try:
41
  image_bytes = response.content
42
  image = Image.open(io.BytesIO(image_bytes))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  print(f'\033[1mGeneration {key} completed!\033[0m ({prompt})')
44
  return image
45
  except Exception as e:
 
40
  try:
41
  image_bytes = response.content
42
  image = Image.open(io.BytesIO(image_bytes))
43
+
44
+ width, height = image.size
45
+ new_width = 640
46
+ new_height = 1024
47
+ left = (width - new_width) / 2
48
+ top = (height - new_height) / 2
49
+ right = (width + new_width) / 2
50
+ bottom = (height + new_height) / 2
51
+ image = image.crop((left, top, right, bottom))
52
+
53
+ # Изменение экспозиции (яркости)
54
+ enhancer = ImageEnhance.Brightness(image)
55
+ image = enhancer.enhance(1.2) # Увеличиваем яркость на 20%
56
+
57
+ # Изменение насыщенности
58
+ enhancer = ImageEnhance.Color(image)
59
+ image = enhancer.enhance(0.8) # Увеличиваем насыщенность на 50%
60
+
61
  print(f'\033[1mGeneration {key} completed!\033[0m ({prompt})')
62
  return image
63
  except Exception as e: