Spaces:
Sleeping
Sleeping
|
Download DEPLOYMENT_GUIDE.md from devilseye2004/tester: direct link, hf CLI and curl.
- Browser
- Download file 3.86 kB
-
https://huggingface.co/spaces/devilseye2004/tester/resolve/main/DEPLOYMENT_GUIDE.md
- Command line
-
hf download hf://spaces/devilseye2004/tester/DEPLOYMENT_GUIDE.md
-
curl -L -o DEPLOYMENT_GUIDE.md https://huggingface.co/spaces/devilseye2004/tester/resolve/main/DEPLOYMENT_GUIDE.md
3.86 kB
Humanizer System Deployment Guide
System Architecture
- Frontend: Next.js on Vercel (
aquahumanizer.vercel.app) - Backend: FastAPI on Hugging Face Spaces (Docker)
- Connection: Frontend calls backend API
Files Cleaned Up
β Removed old/unused files:
humanizer.py(old version)format_preserver.py(old version)- Test files (user removed manually)
Current Files Structure
βββ app.py # Main FastAPI application
βββ config.py # Configuration (no .env needed)
βββ main.py # Entry point for HF Spaces
βββ Dockerfile # Docker configuration for HF Spaces
βββ requirements.txt # Python dependencies
βββ humanizer_three_pass.py # Three-pass humanizer engine
βββ formatting_detector.py # Formatting preservation
βββ markdown_converter.py # Markdown to plain text conversion
βββ export_pipeline.py # DOCX/PDF export (optional)
βββ frontend/ # Next.js frontend (deployed separately)
Key Features Implemented
- β No external AI APIs - Uses internal three-pass humanizer
- β Formatting preservation - Preserves code blocks, lists, tables, URLs, etc.
- β Markdown to plain text conversion - Users get clean text for copy/download
- β Config without .env file - Works on Hugging Face Spaces
- β Dockerfile fixed - No syntax errors, proper main.py
Deployment Steps
1. Backend (Hugging Face Spaces)
- Push this code to GitHub
- Go to Hugging Face Spaces
- Click "Create new Space"
- Select:
- Space name:
humanizer-backend(or your choice) - Space SDK:
Docker - Visibility: Public or Private
- Space name:
- Connect your GitHub repository
- Deploy
2. Frontend (Vercel)
- The frontend is already at
aquahumanizer.vercel.app - In Vercel dashboard, add environment variable:
BACKEND_URL=https://[your-username]-humanizer-backend.hf.space(Replace with your actual HF Spaces URL)
3. Environment Variables
Backend (HF Spaces) - Uses defaults, no .env needed:
PORT= 7860 (default)PASSES= 3 (default)LOG_LEVEL= INFO (default)
Frontend (Vercel):
BACKEND_URL= Your HF Spaces backend URL
Testing Locally
# Install dependencies
pip install -r requirements.txt
# Run backend
uvicorn main:app --host 0.0.0.0 --port 7860
# Frontend (separate terminal)
cd frontend
npm install
npm run dev
API Endpoints
POST /humanize- Humanize textPOST /humanize-document- Process document filesGET /health- Health checkGET /- Redirects to frontendGET /info- System information
Notes
- PDF export (
export_pipeline.py) has weasyprint dependency issues on Windows but might work on HF Spaces (Linux) - If PDF export fails, DOCX and TXT export still work
- The system handles 10,000+ word documents with formatting preservation
- No external API calls - all processing is internal
Troubleshooting
Docker build fails on HF Spaces:
- Check Dockerfile syntax
- Ensure all required files are in repository
Frontend can't connect to backend:
- Verify
BACKEND_URLenvironment variable in Vercel - Check CORS settings in
main.py
- Verify
PDF export not working:
- WeasyPrint requires GTK3 on Linux
- Consider removing weasyprint from
export_pipeline.pyif not needed
Success Indicators
β Backend runs on HF Spaces (Docker container starts) β Frontend connects to backend (API calls work) β Text humanization works (three-pass system) β Formatting preserved (code blocks, lists, etc.) β Copy/download gives plain text (no Markdown syntax)