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 | |
| 1. β **No external AI APIs** - Uses internal three-pass humanizer | |
| 2. β **Formatting preservation** - Preserves code blocks, lists, tables, URLs, etc. | |
| 3. β **Markdown to plain text conversion** - Users get clean text for copy/download | |
| 4. β **Config without .env file** - Works on Hugging Face Spaces | |
| 5. β **Dockerfile fixed** - No syntax errors, proper main.py | |
| ## Deployment Steps | |
| ### 1. Backend (Hugging Face Spaces) | |
| 1. Push this code to GitHub | |
| 2. Go to [Hugging Face Spaces](https://huggingface.co/spaces) | |
| 3. Click "Create new Space" | |
| 4. Select: | |
| - **Space name**: `humanizer-backend` (or your choice) | |
| - **Space SDK**: `Docker` | |
| - **Visibility**: Public or Private | |
| 5. Connect your GitHub repository | |
| 6. Deploy | |
| ### 2. Frontend (Vercel) | |
| 1. The frontend is already at `aquahumanizer.vercel.app` | |
| 2. 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 | |
| ```bash | |
| # 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 text | |
| - `POST /humanize-document` - Process document files | |
| - `GET /health` - Health check | |
| - `GET /` - Redirects to frontend | |
| - `GET /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 | |
| 1. **Docker build fails on HF Spaces**: | |
| - Check Dockerfile syntax | |
| - Ensure all required files are in repository | |
| 2. **Frontend can't connect to backend**: | |
| - Verify `BACKEND_URL` environment variable in Vercel | |
| - Check CORS settings in `main.py` | |
| 3. **PDF export not working**: | |
| - WeasyPrint requires GTK3 on Linux | |
| - Consider removing weasyprint from `export_pipeline.py` if 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) |