Spaces:
Runtime error
Runtime error
Update app.py
Browse files6 unmodified lines78910111213141516171819202122232425262728293031323334353637383940416 unmodified linesdef process_image(image):# Convert image to numpy arrayimg_array = np.array(image)# Dummy sidewalk segmentation (replace with your actual segmentation algorithm)patch_size = 128step = 128all_img_patches = []for i in range(0, img_array.shape[0] - patch_size + 1, step):for j in range(0, img_array.shape[1] - patch_size + 1, step):single_patch_img = img_array[i:i + patch_size, j:j + patch_size]all_img_patches.append(single_patch_img)images = np.array(all_img_patches)# Perform your actual image processing here# Replace the code below with your segmentation algorithm or any other processing you need# This is just a dummy example to show how to process the imageprocessed_images = []for img in images:processed_image = np.mean(img, axis=-1) # Example: Convert to grayscaleprocessed_images.append(processed_image)processed_images = np.array(processed_images)return processed_images# Define Shiny appapp = hf.start()@app.streamlit_app(title="Sidewalk Segmentation App",uploaders={"Upload an image": ["jpg", "jpeg", "png"]}6 unmodified lines78910111213141516171819202122232425262728296 unmodified linesdef process_image(image):# Convert image to numpy arrayimg_array = np.array(image)patch_size = 128step = 128all_img_patches = []for i in range(0, img_array.shape[0] - patch_size + 1, step):for j in range(0, img_array.shape[1] - patch_size + 1, step):single_patch_img = img_array[i:i + patch_size, j:j + patch_size]all_img_patches.append(single_patch_img)images = np.array(all_img_patches)# This is just a example to process the imageprocessed_images = []for img in images:processed_image = np.mean(img, axis=-1) # Example: Convert to grayscaleprocessed_images.append(processed_image)processed_images = np.array(processed_images)return processed_images# Define Shiny appapp = hf.start()@app.streamlit_app(title="Sidewalk Segmentation App",uploaders={"Upload an image": ["jpg", "jpeg", "png"]}
app.py+1-13