Spaces:
Running
Running
Ryan Christian D. Deniega commited on
Commit Β·
70fdb2e
1
Parent(s): aef3106
docs: update README with current deployment, features, and project structure
Browse files
README.md
CHANGED
|
@@ -21,26 +21,44 @@ pinned: false
|
|
| 21 |
<img src="https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react" alt="React">
|
| 22 |
<img src="https://img.shields.io/badge/License-MIT-yellow?style=flat-square" alt="License">
|
| 23 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
---
|
| 26 |
|
| 27 |
## β¨ Features
|
| 28 |
|
| 29 |
-
- **π€ Multimodal Detection** β Verify raw text, news URLs, images
|
|
|
|
|
|
|
|
|
|
| 30 |
- **π΅π Language-Aware** β Seamlessly handles Tagalog, English, and Taglish content
|
| 31 |
- **π§ Advanced NLP Pipeline** β Real-time entity recognition, sentiment/emotion analysis, and clickbait detection
|
| 32 |
-
- **βοΈ Two-Layer Scoring** β Combines ML classification (TF-IDF
|
| 33 |
- **π‘οΈ PH-Domain Verification** β Integrated database of Philippine news domain credibility tiers
|
| 34 |
|
| 35 |
---
|
| 36 |
|
| 37 |
-
## π
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
### Prerequisites
|
| 40 |
|
| 41 |
1. **Python 3.12+**
|
| 42 |
-
2. **Tesseract OCR**
|
| 43 |
-
3. **
|
|
|
|
| 44 |
|
| 45 |
### Installation
|
| 46 |
|
|
@@ -49,12 +67,12 @@ pinned: false
|
|
| 49 |
git clone https://github.com/SemiAutomat1c/philverify.git
|
| 50 |
cd philverify
|
| 51 |
|
| 52 |
-
# Set up
|
| 53 |
python3 -m venv venv
|
| 54 |
source venv/bin/activate
|
| 55 |
pip install -r requirements.txt
|
| 56 |
|
| 57 |
-
# Set up
|
| 58 |
cd frontend
|
| 59 |
npm install
|
| 60 |
```
|
|
@@ -62,14 +80,30 @@ npm install
|
|
| 62 |
### Run
|
| 63 |
|
| 64 |
```bash
|
| 65 |
-
# Backend (from project root)
|
| 66 |
uvicorn main:app --reload --port 8000
|
| 67 |
|
| 68 |
-
# Frontend
|
| 69 |
cd frontend
|
| 70 |
npm run dev
|
| 71 |
```
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
---
|
| 74 |
|
| 75 |
## π οΈ Tech Stack
|
|
@@ -78,9 +112,13 @@ npm run dev
|
|
| 78 |
|-----------|------------|
|
| 79 |
| **Core Backend** | Python 3.12, FastAPI, Pydantic v2 |
|
| 80 |
| **NLP Engine** | spaCy, HuggingFace Transformers, langdetect |
|
| 81 |
-
| **ML Classification** | scikit-learn (TF-IDF +
|
| 82 |
-
| **OCR
|
| 83 |
-
| **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
---
|
| 86 |
|
|
@@ -88,18 +126,18 @@ npm run dev
|
|
| 88 |
|
| 89 |
```
|
| 90 |
PhilVerify/
|
| 91 |
-
βββ main.py # FastAPI app entry point
|
| 92 |
βββ config.py # Settings (pydantic-settings)
|
| 93 |
βββ requirements.txt
|
| 94 |
-
βββ
|
| 95 |
-
βββ domain_credibility.json # PH domain tier database
|
| 96 |
β
|
| 97 |
βββ api/
|
| 98 |
β βββ schemas.py # Pydantic request/response models
|
| 99 |
β βββ routes/
|
| 100 |
-
β βββ verify.py # POST /
|
| 101 |
-
β βββ history.py # GET /history
|
| 102 |
-
β βββ trends.py # GET /trends
|
| 103 |
β
|
| 104 |
βββ nlp/ # NLP preprocessing pipeline
|
| 105 |
β βββ preprocessor.py # Clean, tokenize, remove stopwords (EN+TL)
|
|
@@ -120,11 +158,19 @@ PhilVerify/
|
|
| 120 |
β
|
| 121 |
βββ inputs/
|
| 122 |
β βββ url_scraper.py # BeautifulSoup article extractor
|
| 123 |
-
β βββ ocr.py # Tesseract OCR
|
| 124 |
-
β
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
β
|
| 126 |
βββ tests/
|
| 127 |
-
βββ test_philverify.py #
|
| 128 |
```
|
| 129 |
|
| 130 |
---
|
|
@@ -134,11 +180,13 @@ PhilVerify/
|
|
| 134 |
- [x] Phase 1 β FastAPI backend skeleton
|
| 135 |
- [x] Phase 2 β NLP preprocessing pipeline
|
| 136 |
- [x] Phase 3 β TF-IDF baseline classifier
|
| 137 |
-
- [
|
| 138 |
-
- [
|
| 139 |
-
- [
|
| 140 |
-
- [
|
| 141 |
-
- [ ] Phase 8 β
|
|
|
|
|
|
|
| 142 |
|
| 143 |
---
|
| 144 |
|
|
|
|
| 21 |
<img src="https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react" alt="React">
|
| 22 |
<img src="https://img.shields.io/badge/License-MIT-yellow?style=flat-square" alt="License">
|
| 23 |
</p>
|
| 24 |
+
<p align="center">
|
| 25 |
+
<a href="https://philverify.web.app"><strong>π Live Demo</strong></a> β’
|
| 26 |
+
<a href="https://semiautomat1c-philverify-api.hf.space/docs"><strong>π API Docs</strong></a>
|
| 27 |
+
</p>
|
| 28 |
|
| 29 |
---
|
| 30 |
|
| 31 |
## β¨ Features
|
| 32 |
|
| 33 |
+
- **π€ Multimodal Detection** β Verify raw text, news URLs, images, and video/audio
|
| 34 |
+
- **πΌοΈ Image OCR** β Extract and analyze text from screenshots and images (Tesseract fil+eng)
|
| 35 |
+
- **π¬ Video Frame OCR** β Extract on-screen text from video frames alongside Whisper speech transcription
|
| 36 |
+
- **π Speech Transcription** β Transcribe audio/video content using OpenAI Whisper
|
| 37 |
- **π΅π Language-Aware** β Seamlessly handles Tagalog, English, and Taglish content
|
| 38 |
- **π§ Advanced NLP Pipeline** β Real-time entity recognition, sentiment/emotion analysis, and clickbait detection
|
| 39 |
+
- **βοΈ Two-Layer Scoring** β Combines ML classification (TF-IDF) with NewsAPI evidence retrieval
|
| 40 |
- **π‘οΈ PH-Domain Verification** β Integrated database of Philippine news domain credibility tiers
|
| 41 |
|
| 42 |
---
|
| 43 |
|
| 44 |
+
## π Deployment
|
| 45 |
+
|
| 46 |
+
| Service | Platform | URL |
|
| 47 |
+
|---------|----------|-----|
|
| 48 |
+
| **Frontend** | Firebase Hosting | https://philverify.web.app |
|
| 49 |
+
| **Backend API** | Hugging Face Spaces (Docker) | https://semiautomat1c-philverify-api.hf.space |
|
| 50 |
+
| **API Docs** | Swagger UI (auto-generated) | https://semiautomat1c-philverify-api.hf.space/docs |
|
| 51 |
+
|
| 52 |
+
---
|
| 53 |
+
|
| 54 |
+
## π₯οΈ Local Development
|
| 55 |
|
| 56 |
### Prerequisites
|
| 57 |
|
| 58 |
1. **Python 3.12+**
|
| 59 |
+
2. **Tesseract OCR** β `brew install tesseract tesseract-lang`
|
| 60 |
+
3. **ffmpeg** β `brew install ffmpeg` (required for video frame extraction)
|
| 61 |
+
4. **Node.js 18+** (for frontend)
|
| 62 |
|
| 63 |
### Installation
|
| 64 |
|
|
|
|
| 67 |
git clone https://github.com/SemiAutomat1c/philverify.git
|
| 68 |
cd philverify
|
| 69 |
|
| 70 |
+
# Set up backend
|
| 71 |
python3 -m venv venv
|
| 72 |
source venv/bin/activate
|
| 73 |
pip install -r requirements.txt
|
| 74 |
|
| 75 |
+
# Set up frontend
|
| 76 |
cd frontend
|
| 77 |
npm install
|
| 78 |
```
|
|
|
|
| 80 |
### Run
|
| 81 |
|
| 82 |
```bash
|
| 83 |
+
# Backend (from project root, with venv active)
|
| 84 |
uvicorn main:app --reload --port 8000
|
| 85 |
|
| 86 |
+
# Frontend (in a separate terminal)
|
| 87 |
cd frontend
|
| 88 |
npm run dev
|
| 89 |
```
|
| 90 |
|
| 91 |
+
The frontend dev server proxies `/api` requests to `http://localhost:8000` automatically.
|
| 92 |
+
|
| 93 |
+
### Environment Variables
|
| 94 |
+
|
| 95 |
+
Copy `.env.example` to `.env` and fill in your keys:
|
| 96 |
+
|
| 97 |
+
```
|
| 98 |
+
NEWS_API_KEY=your_newsapi_key
|
| 99 |
+
FIREBASE_PROJECT_ID=your_project_id
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
For frontend production builds, set `VITE_API_BASE_URL` in `frontend/.env.production`:
|
| 103 |
+
```
|
| 104 |
+
VITE_API_BASE_URL=https://your-hf-space.hf.space/api
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
---
|
| 108 |
|
| 109 |
## π οΈ Tech Stack
|
|
|
|
| 112 |
|-----------|------------|
|
| 113 |
| **Core Backend** | Python 3.12, FastAPI, Pydantic v2 |
|
| 114 |
| **NLP Engine** | spaCy, HuggingFace Transformers, langdetect |
|
| 115 |
+
| **ML Classification** | scikit-learn (TF-IDF + Logistic Regression) |
|
| 116 |
+
| **OCR** | Tesseract (fil+eng), pytesseract, Pillow |
|
| 117 |
+
| **ASR** | OpenAI Whisper (base model) |
|
| 118 |
+
| **Video Processing** | ffmpeg (frame extraction), asyncio parallel pipeline |
|
| 119 |
+
| **Frontend** | React 18, TailwindCSS, Chart.js, Vite 7 |
|
| 120 |
+
| **Backend Hosting** | Hugging Face Spaces (Docker SDK, port 7860) |
|
| 121 |
+
| **Frontend Hosting** | Firebase Hosting |
|
| 122 |
|
| 123 |
---
|
| 124 |
|
|
|
|
| 126 |
|
| 127 |
```
|
| 128 |
PhilVerify/
|
| 129 |
+
βββ main.py # FastAPI app entry point + health endpoints
|
| 130 |
βββ config.py # Settings (pydantic-settings)
|
| 131 |
βββ requirements.txt
|
| 132 |
+
βββ Dockerfile # Docker image for HF Spaces (port 7860)
|
| 133 |
+
βββ domain_credibility.json # PH news domain credibility tier database
|
| 134 |
β
|
| 135 |
βββ api/
|
| 136 |
β βββ schemas.py # Pydantic request/response models
|
| 137 |
β βββ routes/
|
| 138 |
+
β βββ verify.py # POST /api/verify β handles text/url/image/video
|
| 139 |
+
β βββ history.py # GET /api/history
|
| 140 |
+
β βββ trends.py # GET /api/trends
|
| 141 |
β
|
| 142 |
βββ nlp/ # NLP preprocessing pipeline
|
| 143 |
β βββ preprocessor.py # Clean, tokenize, remove stopwords (EN+TL)
|
|
|
|
| 158 |
β
|
| 159 |
βββ inputs/
|
| 160 |
β βββ url_scraper.py # BeautifulSoup article extractor
|
| 161 |
+
β βββ ocr.py # Tesseract OCR for images
|
| 162 |
+
β βββ asr.py # Whisper ASR + combined video transcription
|
| 163 |
+
β βββ video_ocr.py # ffmpeg frame extraction + Tesseract OCR for video
|
| 164 |
+
β
|
| 165 |
+
βββ frontend/ # React + Vite frontend
|
| 166 |
+
β βββ src/
|
| 167 |
+
β β βββ pages/
|
| 168 |
+
β β β βββ VerifyPage.jsx # Main fact-check UI (tabs, results, chips)
|
| 169 |
+
β β βββ api.js # API client (supports VITE_API_BASE_URL)
|
| 170 |
+
β βββ .env.production # Production API base URL
|
| 171 |
β
|
| 172 |
βββ tests/
|
| 173 |
+
βββ test_philverify.py # Unit + integration tests
|
| 174 |
```
|
| 175 |
|
| 176 |
---
|
|
|
|
| 180 |
- [x] Phase 1 β FastAPI backend skeleton
|
| 181 |
- [x] Phase 2 β NLP preprocessing pipeline
|
| 182 |
- [x] Phase 3 β TF-IDF baseline classifier
|
| 183 |
+
- [x] Phase 4 β NewsAPI evidence retrieval
|
| 184 |
+
- [x] Phase 5 β React web dashboard with multimodal input
|
| 185 |
+
- [x] Phase 6 β Deploy to Hugging Face Spaces (backend) + Firebase (frontend)
|
| 186 |
+
- [x] Phase 7 β Video frame OCR (ffmpeg + Tesseract alongside Whisper ASR)
|
| 187 |
+
- [ ] Phase 8 β Scoring engine refinement (stance detection)
|
| 188 |
+
- [ ] Phase 9 β Chrome Extension (Manifest V3)
|
| 189 |
+
- [ ] Phase 10 β Fine-tune XLM-RoBERTa / TLUnified-RoBERTa
|
| 190 |
|
| 191 |
---
|
| 192 |
|