Enoder commited on
Commit
8093ef9
·
verified ·
1 Parent(s): 05fcc14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -38,16 +38,8 @@ def generate_image_from_neighbors(base_pixels):
38
  # Déterminer la couleur dominante parmi les pixels environnants
39
  new_pixel_color = dominant_color(surrounding_pixels)
40
 
41
- # Ajouter une petite variation aléatoire
42
- variation = np.array([random.randint(-10, 10) for _ in range(3)])
43
- new_pixel_color = np.clip(new_pixel_color + variation, 0, 255)
44
-
45
- # Vérification pour changer aléatoirement le pixel pour plus d'unicité
46
- if random.random() < 0.2: # 20% de chance de changer le pixel
47
- additional_variation = np.array([random.randint(-20, 20) for _ in range(3)])
48
- new_pixel_color = np.clip(new_pixel_color + additional_variation, 0, 255)
49
-
50
- generated_image[i, j] = new_pixel_color.astype(np.uint8)
51
 
52
  return Image.fromarray(generated_image)
53
 
 
38
  # Déterminer la couleur dominante parmi les pixels environnants
39
  new_pixel_color = dominant_color(surrounding_pixels)
40
 
41
+ # Assignation de la couleur dominante au pixel généré
42
+ generated_image[i, j] = new_pixel_color
 
 
 
 
 
 
 
 
43
 
44
  return Image.fromarray(generated_image)
45