Deployment

Our focus is LLM fundamentals, not deployment. Here's a brief overview of how to share your model.

Gradio Web App

creates instant web UIs for ML models:

python
1import gradio as gr
2
3def calculate(question: str) -> str:
4 return solve(model, tokenizer, question)
5
6demo = gr.Interface(
7 fn=calculate,
8 inputs=gr.Textbox(label="Math Problem", placeholder="two plus three"),
9 outputs=gr.Textbox(label="Result"),
10 title="Calculator Transformer",
11)
12demo.launch()

GitHub Actions → Hugging Face

The repo includes a GitHub Actions workflow that automatically deploys to on every push:

# .github/workflows/deploy.yml
name: Deploy to HF Spaces
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: |
          git push https://huggingface.co/spaces/${{ secrets.HF_USERNAME }}/calculator main
Learn more: See the and for deployment details.
Helpful?