mdanish commited on
Commit
c3e9b25
·
verified ·
1 Parent(s): 34315d4

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -67,6 +67,7 @@ def detect_and_crop_street(panorama_url, use_yolo=True):
67
  largest_box = max(street_boxes, key=lambda box: (box[2]-box[0])*(box[3]-box[1]))
68
  x1, y1, x2, y2 = map(int, largest_box)
69
 
 
70
  # Add some padding
71
  padding = 50
72
  height, width = cv_img.shape[:2]
@@ -291,6 +292,7 @@ def main():
291
  # Display the image
292
  try:
293
  if image_data['is_pano']:
 
294
  image = process_panorama(image_data['thumb_1024_url'])
295
  image_bytes = BytesIO()
296
  image.save(image_bytes, format=image.format)
@@ -299,7 +301,7 @@ def main():
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(
 
67
  largest_box = max(street_boxes, key=lambda box: (box[2]-box[0])*(box[3]-box[1]))
68
  x1, y1, x2, y2 = map(int, largest_box)
69
 
70
+ midx = (x2 - x1) / 2
71
  # Add some padding
72
  padding = 50
73
  height, width = cv_img.shape[:2]
 
292
  # Display the image
293
  try:
294
  if image_data['is_pano']:
295
+ st.write('Processing panoramic image')
296
  image = process_panorama(image_data['thumb_1024_url'])
297
  image_bytes = BytesIO()
298
  image.save(image_bytes, format=image.format)
 
301
  response = requests.get(image_data['thumb_1024_url'])
302
  image = Image.open(BytesIO(response.content))
303
  image_bytes = response.content
304
+ st.image(image, caption="Street View", width=400, output_format='JPEG')
305
 
306
  # Add download button
307
  st.download_button(