provide image bytes in the case of cropped pano image
Browse files
app.py
CHANGED
@@ -292,15 +292,19 @@ def main():
|
|
292 |
try:
|
293 |
if image_data['is_pano']:
|
294 |
image = process_panorama(image_data['thumb_1024_url'])
|
|
|
|
|
|
|
295 |
else:
|
296 |
response = requests.get(image_data['thumb_1024_url'])
|
297 |
image = Image.open(BytesIO(response.content))
|
|
|
298 |
st.image(image, caption="Street View", width=400)
|
299 |
|
300 |
# Add download button
|
301 |
st.download_button(
|
302 |
label="Download Image",
|
303 |
-
data=
|
304 |
file_name=f"streetview_{lat}_{lng}.jpg",
|
305 |
mime="image/jpeg"
|
306 |
)
|
|
|
292 |
try:
|
293 |
if image_data['is_pano']:
|
294 |
image = process_panorama(image_data['thumb_1024_url'])
|
295 |
+
image_bytes = io.BytesIO()
|
296 |
+
image.save(image_bytes, format=image.format)
|
297 |
+
image_bytes = image_bytes.getvalue()
|
298 |
else:
|
299 |
response = requests.get(image_data['thumb_1024_url'])
|
300 |
image = Image.open(BytesIO(response.content))
|
301 |
+
image_bytes = response.content
|
302 |
st.image(image, caption="Street View", width=400)
|
303 |
|
304 |
# Add download button
|
305 |
st.download_button(
|
306 |
label="Download Image",
|
307 |
+
data=image_bytes,
|
308 |
file_name=f"streetview_{lat}_{lng}.jpg",
|
309 |
mime="image/jpeg"
|
310 |
)
|