Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidefiocco/streamlit-fastapi-model-serving
Simple web app example serving a PyTorch model using streamlit and FastAPI
https://github.com/davidefiocco/streamlit-fastapi-model-serving
docker-compose fastapi pycones pytorch streamlit
Last synced: about 1 month ago
JSON representation
Simple web app example serving a PyTorch model using streamlit and FastAPI
- Host: GitHub
- URL: https://github.com/davidefiocco/streamlit-fastapi-model-serving
- Owner: davidefiocco
- License: mit
- Created: 2020-06-20T18:57:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T12:31:46.000Z (9 months ago)
- Last Synced: 2024-09-29T17:40:55.471Z (about 1 month ago)
- Topics: docker-compose, fastapi, pycones, pytorch, streamlit
- Language: Python
- Homepage: https://davidefiocco.github.io/streamlit-fastapi-ml-serving
- Size: 46.9 KB
- Stars: 460
- Watchers: 7
- Forks: 89
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# streamlit-fastapi-model-serving
Simple example of usage of streamlit and FastAPI for ML model serving described on [this blogpost](https://davidefiocco.github.io/streamlit-fastapi-ml-serving) and [PyConES 2020 video](https://www.youtube.com/watch?v=IvHCxycjeR0).
When developing simple APIs that serve machine learning models, it can be useful to have _both_ a backend (with API documentation) for other applications to call and a frontend for users to experiment with the functionality.
In this example, we serve an [image semantic segmentation model](https://pytorch.org/hub/pytorch_vision_deeplabv3_resnet101/) using `FastAPI` for the backend service and `streamlit` for the frontend service. `docker compose` orchestrates the two services and allows communication between them.
To run the example in a machine running Docker and docker compose, run:
docker compose build
docker compose upTo visit the FastAPI documentation of the resulting service, visit http://localhost:8000/docs with a web browser.
To visit the streamlit UI, visit http://localhost:8501.Logs can be inspected via:
docker compose logs
### Debugging
To modify and debug the app, [development in containers](https://davidefiocco.github.io/debugging-containers-with-vs-code) can be useful (and kind of fun!).