cv200 / STREAMLIT_DEPLOYMENT.md
Solareva Taisia
Fix Python 3.9 compatibility (zip strict)
523b89b

Streamlit Deployment Guide

Deploy to Streamlit Community Cloud

Follow the same pattern as the NLP project:

1. Push to GitHub

Make sure your code is in a GitHub repository:

cd "/Users/tay/Development/portfolio projects/cv200"
# If not already a git repo, initialize and push to GitHub
git remote add origin https://github.com/your-username/cv200.git
git push -u origin main

2. Deploy on Streamlit Cloud

  1. Go to Streamlit Community Cloud:

  2. Configure deployment:

    • Repository: Select your GitHub repo (the one with streamlit_app.py)
    • Branch: main (or your branch)
    • Main file path: streamlit_app.py
    • Python version: 3.9 or 3.10
  3. Set Secrets (optional but recommended):

    • Click "Advanced settings"
    • Add secret: API_URL = https://solarevat-cv200.hf.space
    • This allows the app to use your HF Spaces API
  4. Deploy:

    • Click "Deploy"
    • Streamlit will automatically:
      • Install dependencies from requirements-streamlit.txt
      • Run streamlit run streamlit_app.py
    • Your app will be live at: https://your-app-name.streamlit.app

3. Verify Deployment

  • Open your Streamlit app URL
  • Upload a pet image
  • Verify it calls your HF Spaces API correctly

Local Testing

Before deploying, test locally:

cd "/Users/tay/Development/portfolio projects/cv200"
pip install -r requirements-streamlit.txt
streamlit run streamlit_app.py

Then open http://localhost:8501 in your browser.

Update API URL

If your API URL is different, edit streamlit_app.py:

API_URL = "https://your-actual-url.hf.space"

Features

  • βœ… Image upload with preview
  • βœ… Top 5 predictions with confidence scores
  • βœ… Progress bars for visual feedback
  • βœ… Sidebar with API information
  • βœ… Error handling
  • βœ… Responsive design

Notes

  • The Streamlit app calls your HF Spaces API
  • Make sure CORS is enabled in your API (already done)
  • The app doesn't need the model files - it just calls the API
  • Much simpler than managing HTML/JavaScript!