INNER CODE UNIT · Python
process
davidefiocco/streamlit-fastapi-model-serving · streamlit/ui.py:13
def process(image, server_url: str):
m = MultipartEncoder(fields={"file": ("filename", image, "image/jpeg")})
r = requests.post(
server_url, data=m, headers={"Content-Type": m.content_type}, timeout=8000
)
return r
# construct UI layout
st.title("DeepLabV3 image segmentation")
st.write(
"""Obtain semantic segmentation maps of the image in input via DeepLabV3 implemented in PyTorch.
This streamlit example uses a FastAPI service as backend.
Visit this URL at `:8000/docs` for FastAPI documentation."""