Skip to content

Latest commit

 

History

History
144 lines (101 loc) · 4.29 KB

File metadata and controls

144 lines (101 loc) · 4.29 KB

Streamlit Demo on Akash

Deploy on Akash streamlit-logo-primary-colormark-darktext

Deploy interactive machine learning apps and data dashboards using Streamlit on Akash Network's decentralized cloud.

What is Streamlit?

Streamlit is an open-source Python library that lets you turn data scripts into shareable web apps in minutes — with no frontend experience required. It's the go-to tool for ML engineers and data scientists who want to:

  • Demo machine learning models interactively
  • Build data visualization dashboards
  • Prototype and share AI-powered tools
  • Create internal apps without writing HTML/CSS/JS

What's Included

This template deploys a simple Streamlit application with two demo interfaces:

  1. Text Analysis — Mock sentiment analysis with confidence scoring
  2. Image Captioning — Mock image description generator with file upload

You can easily swap in your own models or logic by editing app.py.

Deployment

Deploy on Akash Console (Recommended)

  1. Go to console.akash.network
  2. Click DeployBuild Your Template
  3. Upload the deploy.yaml file or use the one-click button above
  4. Review resources and set your pricing bid
  5. Sign and deploy
  6. Access your Streamlit app at the provided URL on port 80

Deploy via Akash CLI

  1. Clone the repository:
git clone https://github.com/akash-network/awesome-akash.git
cd awesome-akash/streamlit-demo
  1. Create the deployment:
akash tx deployment create deploy.yaml \
  --from <your-wallet> \
  --node https://rpc.akashnet.net:443 \
  --chain-id akashnet-2
  1. Accept a bid and create a lease, then fetch your deployment URL from the lease status.

Customization

Use Your Own Model

Replace the demo functions in app.py with real ML logic. Example using HuggingFace Transformers:

import streamlit as st
from transformers import pipeline

@st.cache_resource
def load_model():
    return pipeline("sentiment-analysis")

classifier = load_model()

st.title("Sentiment Analysis")
text = st.text_area("Enter text")

if st.button("Analyze"):
    result = classifier(text)[0]
    st.success(f"**{result['label']}** — {result['score']:.2%} confidence")

Then build a custom Docker image with your dependencies and update the image: field in deploy.yaml.

Adjust Resources

Edit deploy.yaml to allocate more CPU or memory for heavier workloads:

resources:
  cpu:
    units: 2.0      # Increase for CPU-intensive models
  memory:
    size: 4Gi       # Increase for larger models or datasets
  storage:
    size: 5Gi       # Increase if loading model weights from disk

Add GPU Support

To run GPU-accelerated models, add a GPU resource block and use a CUDA-enabled base image:

resources:
  cpu:
    units: 4.0
  memory:
    size: 16Gi
  storage:
    size: 20Gi
  gpu:
    units: 1
    attributes:
      vendor:
        nvidia:
          - model: rtx3090

Port Reference

Service Container Port Exposed As
Streamlit 8501 80 (HTTP)

Cost Estimate

Typical cost on Akash: ~$5–15/month depending on provider and resource allocation — significantly cheaper than equivalent workloads on AWS, GCP, or Heroku.

Example Use Cases

  • Deploy HuggingFace models for text generation, classification, or translation
  • Build interactive dashboards for data exploration
  • Share ML research demos without provisioning servers
  • Host internal tools accessible from anywhere

Resources

Support