Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,7 +89,7 @@ def home_page():
|
|
| 89 |
</head>
|
| 90 |
<body>
|
| 91 |
<img class="banner" src="/static/images/banner.jpg" alt="Banner" width="100%">
|
| 92 |
-
<h2>
|
| 93 |
<p>Please select an option below:</p>
|
| 94 |
<ul>
|
| 95 |
<li><a href="/demo">Demo</a></li>
|
|
@@ -114,7 +114,7 @@ def demo_page():
|
|
| 114 |
# Process the first image
|
| 115 |
response = requests.get(url1)
|
| 116 |
img1 = Image.open(BytesIO(response.content)).convert("RGB")
|
| 117 |
-
rectangled_img1 = cropper(img1,
|
| 118 |
output1 = BytesIO()
|
| 119 |
rectangled_img1.save(output1, format="JPEG")
|
| 120 |
encoded_img1 = base64.b64encode(output1.getvalue()).decode("utf-8")
|
|
@@ -122,7 +122,7 @@ def demo_page():
|
|
| 122 |
# Process the second image
|
| 123 |
response = requests.get(url2)
|
| 124 |
img2 = Image.open(BytesIO(response.content)).convert("RGB")
|
| 125 |
-
rectangled_img2 = cropper(img2,
|
| 126 |
output2 = BytesIO()
|
| 127 |
rectangled_img2.save(output2, format="JPEG")
|
| 128 |
encoded_img2 = base64.b64encode(output2.getvalue()).decode("utf-8")
|
|
@@ -136,7 +136,7 @@ def demo_page():
|
|
| 136 |
<body>
|
| 137 |
<img class="banner" src="/static/images/banner.jpg" alt="Banner" width="100%">
|
| 138 |
<h2>Recsize Image Demo (CPU Optimized)</h2>
|
| 139 |
-
<p>Image will be
|
| 140 |
<h3>Result 1:</h3>
|
| 141 |
<img src="data:image/jpeg;base64,{encoded_img1}" />
|
| 142 |
<h3>Result 2:</h3>
|
|
@@ -172,7 +172,7 @@ def application_page():
|
|
| 172 |
<label for="target_height">Target Height (px):</label>
|
| 173 |
<input type="number" id="target_height" name="target_height" min="1" max="1600" required><br><br>
|
| 174 |
|
| 175 |
-
<input type="submit" value="
|
| 176 |
</form>
|
| 177 |
<a href="/">Back</a>
|
| 178 |
<div id="credit">Image credit
|
|
|
|
| 89 |
</head>
|
| 90 |
<body>
|
| 91 |
<img class="banner" src="/static/images/banner.jpg" alt="Banner" width="100%">
|
| 92 |
+
<h2>Recsize Image App</h2>
|
| 93 |
<p>Please select an option below:</p>
|
| 94 |
<ul>
|
| 95 |
<li><a href="/demo">Demo</a></li>
|
|
|
|
| 114 |
# Process the first image
|
| 115 |
response = requests.get(url1)
|
| 116 |
img1 = Image.open(BytesIO(response.content)).convert("RGB")
|
| 117 |
+
rectangled_img1 = cropper(img1,200,200)
|
| 118 |
output1 = BytesIO()
|
| 119 |
rectangled_img1.save(output1, format="JPEG")
|
| 120 |
encoded_img1 = base64.b64encode(output1.getvalue()).decode("utf-8")
|
|
|
|
| 122 |
# Process the second image
|
| 123 |
response = requests.get(url2)
|
| 124 |
img2 = Image.open(BytesIO(response.content)).convert("RGB")
|
| 125 |
+
rectangled_img2 = cropper(img2,300,300)
|
| 126 |
output2 = BytesIO()
|
| 127 |
rectangled_img2.save(output2, format="JPEG")
|
| 128 |
encoded_img2 = base64.b64encode(output2.getvalue()).decode("utf-8")
|
|
|
|
| 136 |
<body>
|
| 137 |
<img class="banner" src="/static/images/banner.jpg" alt="Banner" width="100%">
|
| 138 |
<h2>Recsize Image Demo (CPU Optimized)</h2>
|
| 139 |
+
<p>Image will be resized as per your input pixel numbers.</p>
|
| 140 |
<h3>Result 1:</h3>
|
| 141 |
<img src="data:image/jpeg;base64,{encoded_img1}" />
|
| 142 |
<h3>Result 2:</h3>
|
|
|
|
| 172 |
<label for="target_height">Target Height (px):</label>
|
| 173 |
<input type="number" id="target_height" name="target_height" min="1" max="1600" required><br><br>
|
| 174 |
|
| 175 |
+
<input type="submit" value="Resize It">
|
| 176 |
</form>
|
| 177 |
<a href="/">Back</a>
|
| 178 |
<div id="credit">Image credit
|