latest_Rag_SaaS_Access_Point / DEPLOYMENT_GUIDE.md
GodRad's picture
Upload 7 files
966243e verified
|
Raw History Blame Contribute Delete
3.48 kB

A newer version of the Streamlit SDK is available: 1.66.1

Upgrade

RAG SaaS Platform - Webapp Deployment Guide

βœ… Webapp Status: READY FOR DEPLOYMENT

All issues have been resolved. The webapp is clean and ready to deploy.


Files in webapp/ Directory

1. app.py (26.7 KB)

  • βœ… Clean imports at the top (no lazy loading)
  • βœ… All 7 critical fixes integrated
  • βœ… Multi-source retrieval UI
  • βœ… Tenant authentication
  • βœ… Metrics display with latency breakdown
  • βœ… Document/URL/YouTube source management

2. requirements.txt

streamlit
requests
pandas
  • βœ… Minimal dependencies for fast startup

3. Dockerfile

  • βœ… Configured for HF Spaces
  • βœ… User permissions (UID 1000)
  • βœ… Port 7860
  • βœ… Streamlit entrypoint

4. .streamlit/config.toml

  • βœ… Headless mode
  • βœ… Dark theme
  • βœ… Performance optimizations

5. README.md

  • βœ… HF Spaces metadata
  • βœ… Quick setup guide

Deployment Options

Option 1: Streamlit SDK (Recommended for UI) ⭐

Fastest startup time!

  1. Create new Space on Hugging Face
  2. Settings:
    • SDK: Streamlit
    • SDK Version: 1.28.0
    • App File: app.py
  3. Upload files:
    • app.py
    • requirements.txt
    • .streamlit/config.toml
    • README.md

Expected startup: 8-12 seconds


Option 2: Docker SDK

  1. Create new Space on Hugging Face
  2. Settings:
    • SDK: Docker
  3. Upload files:
    • app.py
    • requirements.txt
    • Dockerfile
    • .streamlit/config.toml
    • README.md

Expected startup: 15-20 seconds


Configuration

Backend URL

In the sidebar, users can configure the backend API URL:

  • Local development: http://localhost:7860
  • HF Spaces backend: https://YOUR_USERNAME-rag-saas-backend.hf.space

Features

1. Authentication

  • Login with Tenant ID
  • Create new tenant accounts
  • Secure session management

2. Ask Questions

  • Multi-source retrieval (docs, URLs, YouTube)
  • Real-time latency metrics
  • 5-metric performance breakdown
  • Visual latency chart
  • Confidence scoring
  • Source attribution

3. Manage Sources

  • Upload documents (PDF, DOCX, TXT)
  • Add web URLs
  • Add YouTube videos (with transcript upload)
  • Enable/disable sources
  • View all sources

4. Metrics Dashboard

  • Tenant-specific metrics
  • Time-range selection
  • Cache performance stats
  • Historical trends

Testing Locally

cd webapp
streamlit run app.py --server.port=8501

Then open: http://localhost:8501


Deployment Checklist

  • app.py - Clean, no lazy loading
  • requirements.txt - Minimal dependencies
  • Dockerfile - HF Spaces compatible
  • .streamlit/config.toml - Optimized settings
  • README.md - HF metadata
  • All imports working
  • No syntax errors
  • Ready for deployment

Next Steps

  1. Deploy Backend First

    • Upload backend to HF Spaces (Docker SDK)
    • Get backend URL
  2. Deploy Frontend

    • Upload webapp to HF Spaces (Streamlit SDK)
    • Configure backend URL in sidebar
  3. Test End-to-End

    • Create tenant
    • Add sources
    • Ask questions
    • Check metrics

Summary

βœ… Webapp is production-ready!

  • Clean code with standard imports
  • All 7 critical fixes integrated
  • Optimized for HF Spaces
  • Fast startup (8-12 seconds)
  • Full feature parity with backend