Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,6 @@ ASCII_CHARS = [
|
|
| 19 |
'u', 'n', 'm', 'w', 'Q', 'B', 'N', 'M', '@'
|
| 20 |
]
|
| 21 |
|
| 22 |
-
|
| 23 |
def preprocess_image(image, new_width=150):
|
| 24 |
"""
|
| 25 |
This function performs the following operations on the input image:
|
|
@@ -51,10 +50,10 @@ def preprocess_image(image, new_width=150):
|
|
| 51 |
enhancer = ImageEnhance.Contrast(edges_image)
|
| 52 |
enhanced_edges = enhancer.enhance(1.5)
|
| 53 |
enhanced_edges = np.array(enhanced_edges)
|
| 54 |
-
|
| 55 |
# Resize the image for ASCII aspect ratio
|
| 56 |
width, height = image.size
|
| 57 |
-
aspect_ratio = height / width * 0.
|
| 58 |
new_height = int(aspect_ratio * new_width)
|
| 59 |
resized_image = Image.fromarray(enhanced_edges).resize((new_width, new_height))
|
| 60 |
|
|
|
|
| 19 |
'u', 'n', 'm', 'w', 'Q', 'B', 'N', 'M', '@'
|
| 20 |
]
|
| 21 |
|
|
|
|
| 22 |
def preprocess_image(image, new_width=150):
|
| 23 |
"""
|
| 24 |
This function performs the following operations on the input image:
|
|
|
|
| 50 |
enhancer = ImageEnhance.Contrast(edges_image)
|
| 51 |
enhanced_edges = enhancer.enhance(1.5)
|
| 52 |
enhanced_edges = np.array(enhanced_edges)
|
| 53 |
+
|
| 54 |
# Resize the image for ASCII aspect ratio
|
| 55 |
width, height = image.size
|
| 56 |
+
aspect_ratio = height / width * 0.55 # Adjusting for ASCII aspect ratio
|
| 57 |
new_height = int(aspect_ratio * new_width)
|
| 58 |
resized_image = Image.fromarray(enhanced_edges).resize((new_width, new_height))
|
| 59 |
|