joshangngoching commited on
Commit
d3cdfaa
1 Parent(s): b013dca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -64,10 +64,11 @@ if uploaded_file is not None:
64
  with col1:
65
  st.image(image, caption='Uploaded Image.', use_column_width=True)
66
 
67
- semantic_segmentation = pipeline("image-segmentation", f"nvidia/segformer-b5-finetuned-cityscapes-1024-1024")
68
- segmentation_results = semantic_segmentation(image)
69
- image_with_masks = draw_masks_fromDict(np.array(image)[:, :, :3], segmentation_results)
70
- image_with_masks_pil = Image.fromarray(image_with_masks, 'RGB')
 
71
 
72
  with col2:
73
  st.image(image_with_masks_pil, caption='Segmented Image.', use_column_width=True)
 
64
  with col1:
65
  st.image(image, caption='Uploaded Image.', use_column_width=True)
66
 
67
+ with st.spinner('Processing...'):
68
+ semantic_segmentation = pipeline("image-segmentation", f"nvidia/segformer-b1-finetuned-cityscapes-1024-1024")
69
+ segmentation_results = semantic_segmentation(image)
70
+ image_with_masks = draw_masks_fromDict(np.array(image)[:, :, :3], segmentation_results)
71
+ image_with_masks_pil = Image.fromarray(image_with_masks, 'RGB')
72
 
73
  with col2:
74
  st.image(image_with_masks_pil, caption='Segmented Image.', use_column_width=True)