Deploy interactive machine learning demos and data apps using Gradio on Akash Network's decentralized cloud.
Gradio is a Python library that allows you to quickly create customizable web interfaces for machine learning models, APIs, or any Python function. Perfect for:
- Demoing ML models
- Creating interactive data visualizations
- Building simple web tools without learning web development
- Prototyping AI applications
This template deploys a simple Gradio application with two demo interfaces:
- Text Analysis - Mock sentiment analysis demo
- Image Captioning - Mock image description generator
You can easily customize app.py to add your own models or functions.
- Akash CLI installed
- Akash wallet with ACT tokens
- Basic familiarity with Akash deployments
- Clone this repository:
git clone https://github.com/akash-network/awesome-akash.git
cd awesome-akash/gradio-demo- Deploy using Akash CLI:
akash tx deployment create deploy.yaml --from <your-wallet> --node https://rpc.akashnet.net:443 --chain-id akashnet-2- Get your deployment URL: After deployment, check your lease status to find the public URL where your Gradio app is accessible.
- Go to console.akash.network
- Click "Deploy" → "Build Your Template"
- Upload the
deploy.yamlfile - Configure resources and pricing
- Sign and deploy
- Access your app via the provided URL
Edit app.py to replace the demo functions with your actual ML models:
import gradio as gr
from transformers import pipeline
# Load your model
classifier = pipeline("sentiment-analysis")
def analyze_sentiment(text):
result = classifier(text)[0]
return f"Sentiment: {result['label']}\nConfidence: {result['score']:.2%}"
demo = gr.Interface(
fn=analyze_sentiment,
inputs=gr.Textbox(label="Enter text"),
outputs=gr.Textbox(label="Result"),
title="Sentiment Analysis on Akash"
)
demo.launch(server_name="0.0.0.0", server_port=7860)Modify the deploy.yaml file to allocate more CPU/RAM if you're running larger models:
resources:
cpu:
units: 2.0 # Increase for heavier workloads
memory:
size: 4Gi # Increase for larger modelsEstimated cost on Akash: ~$5-15/month depending on provider and resource allocation.
Significantly cheaper than AWS, Google Cloud, or Heroku for similar workloads.
- Deploy Hugging Face models for text generation, translation, or classification
- Create data visualization dashboards
- Build interactive demos for research papers or projects
- Host ML model APIs accessible from anywhere
For issues or questions:
- Akash Discord: discord.akash.network
- Gradio Community: huggingface.co/spaces