Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,12 @@ def preprocessing(image):
|
|
20 |
"""Apply three enhancement filters, including brightness reduction, and resize."""
|
21 |
image = Image.fromarray(np.array(image))
|
22 |
|
23 |
-
|
24 |
image = ImageEnhance.Sharpness(image).enhance(2.0) # Increase sharpness
|
25 |
image = ImageEnhance.Contrast(image).enhance(1.5) # Increase contrast
|
26 |
image = ImageEnhance.Brightness(image).enhance(0.8) # Reduce brightness
|
27 |
|
28 |
-
|
29 |
width = 800
|
30 |
aspect_ratio = image.height / image.width
|
31 |
height = int(width * aspect_ratio)
|
@@ -108,7 +108,7 @@ def predict(image):
|
|
108 |
if "back" in cropped_images:
|
109 |
back_result = vision_ai_api(cropped_images["back"], "back")
|
110 |
|
111 |
-
|
112 |
api_results = {
|
113 |
"front": front_result,
|
114 |
"back": back_result
|
|
|
20 |
"""Apply three enhancement filters, including brightness reduction, and resize."""
|
21 |
image = Image.fromarray(np.array(image))
|
22 |
|
23 |
+
|
24 |
image = ImageEnhance.Sharpness(image).enhance(2.0) # Increase sharpness
|
25 |
image = ImageEnhance.Contrast(image).enhance(1.5) # Increase contrast
|
26 |
image = ImageEnhance.Brightness(image).enhance(0.8) # Reduce brightness
|
27 |
|
28 |
+
|
29 |
width = 800
|
30 |
aspect_ratio = image.height / image.width
|
31 |
height = int(width * aspect_ratio)
|
|
|
108 |
if "back" in cropped_images:
|
109 |
back_result = vision_ai_api(cropped_images["back"], "back")
|
110 |
|
111 |
+
|
112 |
api_results = {
|
113 |
"front": front_result,
|
114 |
"back": back_result
|