digimap-web-app / app.py
joshangngoching's picture
Update app.py
2aa7829 verified
raw
history blame
486 Bytes
import streamlit as st
from PIL import Image
from transformers import pipeline
semantic_segmentation = pipeline("image-segmentation", "nvidia/segformer-b1-finetuned-cityscapes-1024-1024")
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png"])
if uploaded_file is not None:
image = Image.open(uploaded_file)
st.image(image, caption='Uploaded Image.', use_column_width=True)
st.write("")
results = semantic_segmentation(image)
st.json(results)