Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,36 +44,6 @@ def fill_rectangle_cropper(img, padding_type):
|
|
| 44 |
newimg.paste(img, (padding_left, 0)) # Center the image horizontally
|
| 45 |
return newimg
|
| 46 |
|
| 47 |
-
# Function for cropping and filling the image
|
| 48 |
-
def fill_rectangle_cropper1(img):
|
| 49 |
-
imgsz = [img.height, img.width]
|
| 50 |
-
avg_color_per_row = np.average(img, axis=0)
|
| 51 |
-
avg_color = np.average(avg_color_per_row, axis=0)
|
| 52 |
-
|
| 53 |
-
if img.height > img.width:
|
| 54 |
-
newimg = Image.new(
|
| 55 |
-
'RGB',
|
| 56 |
-
(img.height, img.height),
|
| 57 |
-
(round(avg_color[0]), round(avg_color[1]), round(avg_color[2]))
|
| 58 |
-
)
|
| 59 |
-
newpos = (img.height - img.width) // 2
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
newimg.paste(img, (newpos, 0))
|
| 63 |
-
return newimg
|
| 64 |
-
|
| 65 |
-
elif img.width > img.height:
|
| 66 |
-
newimg = Image.new(
|
| 67 |
-
'RGB',
|
| 68 |
-
(img.width, img.width),
|
| 69 |
-
(round(avg_color[0]), round(avg_color[1]), round(avg_color[2]))
|
| 70 |
-
)
|
| 71 |
-
newpos = (img.width - img.height) // 2
|
| 72 |
-
newimg.paste(img, (0, newpos))
|
| 73 |
-
return newimg
|
| 74 |
-
else:
|
| 75 |
-
return img
|
| 76 |
-
|
| 77 |
# Home Page
|
| 78 |
@app.get("/", response_class=HTMLResponse)
|
| 79 |
def home_page():
|
|
@@ -82,6 +52,7 @@ def home_page():
|
|
| 82 |
<head>
|
| 83 |
<title>Part of Idoia's Developer Portfolio - Innovating the Web</title>
|
| 84 |
<link rel="stylesheet" href="/static/styles/style.css">
|
|
|
|
| 85 |
|
| 86 |
<!-- Meta Tags for SEO -->
|
| 87 |
<meta charset="UTF-8">
|
|
|
|
| 44 |
newimg.paste(img, (padding_left, 0)) # Center the image horizontally
|
| 45 |
return newimg
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# Home Page
|
| 48 |
@app.get("/", response_class=HTMLResponse)
|
| 49 |
def home_page():
|
|
|
|
| 52 |
<head>
|
| 53 |
<title>Part of Idoia's Developer Portfolio - Innovating the Web</title>
|
| 54 |
<link rel="stylesheet" href="/static/styles/style.css">
|
| 55 |
+
<style>body {text-align:center;}</style>
|
| 56 |
|
| 57 |
<!-- Meta Tags for SEO -->
|
| 58 |
<meta charset="UTF-8">
|