Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
#
|
| 42 |
-
|
| 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 |
|