Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 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)
|