File size: 3,136 Bytes
4cfceb1
325e5a1
 
 
 
4cfceb1
325e5a1
4cfceb1
 
 
 
325e5a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: Humanzise API
emoji: πŸͺ„
colorFrom: green
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
short_description: Free AI text humanizer and detector
---

# Humanzise

Free, open-source **AI text humanizer** + **AI detector**. Paste any AI-generated text and rewrite it to sound more natural β€” or check how likely an existing text was written by AI.

- **Frontend**: Next.js 16 + shadcn/ui + Tailwind CSS (deployed on Vercel)
- **Backend**: FastAPI + PyTorch + DeBERTa-v3 detector (deployed on Hugging Face Spaces)
- **Detector model**: [`desklib/ai-text-detector-v1.01`](https://huggingface.co/desklib/ai-text-detector-v1.01) β€” current leader on the RAID benchmark
- **Humanizer**: rule-based pipeline (WordNet synonyms + contraction expansion + academic transitions + citation preservation)

## Repository layout

```
humanzise/
β”œβ”€β”€ api/                   FastAPI app (entry point: api.humanize_api:app)
β”‚   └── humanize_api.py
β”œβ”€β”€ utils/                 Backend logic
β”‚   β”œβ”€β”€ humanizer_core.py  Text humanization pipeline
β”‚   β”œβ”€β”€ ai_detection_utils.py
β”‚   β”œβ”€β”€ desklib_model.py   Custom DeBERTa-v3 wrapper for desklib weights
β”‚   β”œβ”€β”€ model_loaders.py
β”‚   └── pdf_utils.py       PDF text extraction
β”œβ”€β”€ web/                   Next.js frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ app/
β”‚       β”œβ”€β”€ components/
β”‚       └── lib/
β”œβ”€β”€ Dockerfile             HF Spaces Docker image
β”œβ”€β”€ requirements.txt       Production deps (lean, CPU-only torch)
β”œβ”€β”€ requirements-local.txt All dev deps
└── DEPLOY.md              Step-by-step deployment guide
```

## Running locally

### Backend (Python 3.12)

```bash
python -m venv venv
source venv/Scripts/activate        # or venv/bin/activate on macOS/Linux
pip install -r requirements-local.txt
python -m spacy download en_core_web_sm

python -m uvicorn api.humanize_api:app --reload --port 8000
```

Scalar docs: http://localhost:8000/docs

### Frontend (Node 20+)

```bash
cd web
npm install
npm run dev
```

Open http://localhost:3000. Set `NEXT_PUBLIC_API_BASE_URL` in `web/.env.local` if your backend isn't on `http://127.0.0.1:8000`.

## API endpoints

| Method | Path | Description |
|---|---|---|
| `GET`  | `/health` | Liveness probe |
| `POST` | `/humanize` | Rewrite AI text to sound more natural |
| `POST` | `/detect` | Score text for AI likelihood (desklib DeBERTa-v3) |
| `POST` | `/extract-file` | Extract text from uploaded PDF/TXT/MD |

All endpoints use JSON request/response; `/extract-file` uses `multipart/form-data`.

## Deployment

Free deployment path is documented in [DEPLOY.md](./DEPLOY.md):

- **Frontend** β†’ Vercel (free, `web/` subfolder)
- **Backend** β†’ Hugging Face Spaces (Docker SDK, free 16 GB RAM)

## Credits

Forked from [DadaNanjesha/AI-content-detector-Humanizer](https://github.com/DadaNanjesha/AI-content-detector-Humanizer) β€” original Streamlit app. This fork replaced the Streamlit UI with a Next.js frontend, modernized the backend, and swapped in the desklib detector.

## License

MIT β€” see [LICENSE](./LICENSE).