Skip to content

AscentSoftware/ds-accelerator-streamlit-fastapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Science App Platform

This accelerator provisions an Azure environment consisting of frontend (Streamlit) and backend (FastAPI) Container Apps with some mock data for proof of concept or demonstration purposes.

Deployment

The full solution, including infrastructure provisioning, application builds and deployments can be initiated using the Azure Developer CLI (azd):

# Authenticate to Azure
azd auth login

# Full deployment
azd up

To provision/update the infrastructure only, run:

# Only provision infrastructure
azd provision

To build/deploy the applications only, run:

# Build/package all apps
azd package

# Deploy all apps
azd deploy

Local Development

The solution can be developed locally in containers, and so requires Docker and Docker Compose to be installed:

# Ensure the Docker daemon is running (run in a separate terminal window)
sudo dockerd

# Build/start all apps
cd ./src
docker compose up --build

# Frontend: https://localhost:8051
# Backend: https://localhost:8052

Both the frontend and backend apps will update live, so any code changes will be reflected in the running container and in the local browser immediately.

Model Explainability Lab (NEW)

The platform now includes a "Model Explainability Lab" demo accessible via the Streamlit frontend. It showcases end-to-end exploratory model insight flows using static, precomputed artifacts for two datasets:

Datasets:

  • iris (multiclass classification)
  • titanic (binary classification)

Backend endpoints (FastAPI):

  • GET /datasets – list available datasets
  • GET /schema?dataset=... – schema (features, target, classes)
  • POST /train – returns metrics, ROC curve, confusion matrix, importances
  • POST /predict – mock prediction for supplied feature values
  • POST /explain – SHAP-like contributions (stored row or ad-hoc features)
  • GET /pdp?dataset=...&feature=... – partial dependence data
  • GET /healthz – health probe

Frontend tabs:

  1. Performance: ROC + confusion matrix heatmap
  2. Importances: Bar chart of feature importances
  3. What-If: Editable feature inputs → prediction probabilities
  4. Explanations: Stored row and ad-hoc SHAP-like contribution bars
  5. PDP: Feature-level partial dependence line chart

How to run locally (backend only for quick test):

uvicorn backend.app:app --reload --port 8000

Then start Streamlit frontend (if not using Docker Compose):

streamlit run src/frontend/app.py

Testing backend endpoints:

pytest -q src/backend/tests

All model outputs are deterministic and sourced from JSON under src/backend/data/. Replace or augment these files to plug in new datasets.

About

Provisions a simple Streamlit frontend and FastAPI backend on Azure Container Apps using the Azure Developer CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 63.7%
  • Bicep 35.3%
  • Dockerfile 1.0%