TrBn17 commited on
Commit Β·
6a62b08
1
Parent(s): e775b41
Update README.md with proper Gradio SDK configuration
Browse files- README.md +12 -84
- README_HF.md +0 -10
- README_gradio.md +0 -47
README.md
CHANGED
|
@@ -1,84 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
|
| 14 |
-
## API Endpoints
|
| 15 |
-
|
| 16 |
-
- `GET /` - API information
|
| 17 |
-
- `GET /health` - Health check
|
| 18 |
-
- `POST /predict` - Single prediction
|
| 19 |
-
- `POST /predict_batch` - Batch predictions
|
| 20 |
-
- `GET /docs` - Interactive API documentation
|
| 21 |
-
|
| 22 |
-
## Quick Start
|
| 23 |
-
|
| 24 |
-
### Using Docker
|
| 25 |
-
|
| 26 |
-
```bash
|
| 27 |
-
# Build and run with docker-compose
|
| 28 |
-
docker-compose up --build
|
| 29 |
-
|
| 30 |
-
# Or build and run manually
|
| 31 |
-
docker build -t svm-classifier .
|
| 32 |
-
docker run -p 8000:8000 svm-classifier
|
| 33 |
-
```
|
| 34 |
-
|
| 35 |
-
### Local Development
|
| 36 |
-
|
| 37 |
-
```bash
|
| 38 |
-
# Install dependencies
|
| 39 |
-
pip install -r requirements.txt
|
| 40 |
-
|
| 41 |
-
# Run the application
|
| 42 |
-
python app.py
|
| 43 |
-
# or
|
| 44 |
-
python start.py
|
| 45 |
-
# or
|
| 46 |
-
uvicorn app:app --host 0.0.0.0 --port 8000
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
## Usage
|
| 50 |
-
|
| 51 |
-
### Single Prediction
|
| 52 |
-
|
| 53 |
-
```bash
|
| 54 |
-
curl -X POST "http://localhost:8000/predict" \
|
| 55 |
-
-H "Content-Type: application/json" \
|
| 56 |
-
-H "x-api-key: super-secret-key" \
|
| 57 |
-
-d '{
|
| 58 |
-
"title": "Breaking News",
|
| 59 |
-
"text": "This is a news article text..."
|
| 60 |
-
}'
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
### Batch Prediction
|
| 64 |
-
|
| 65 |
-
```bash
|
| 66 |
-
curl -X POST "http://localhost:8000/predict_batch" \
|
| 67 |
-
-H "Content-Type: application/json" \
|
| 68 |
-
-H "x-api-key: super-secret-key" \
|
| 69 |
-
-d '{
|
| 70 |
-
"items": [
|
| 71 |
-
{"title": "News 1", "text": "Text 1"},
|
| 72 |
-
{"title": "News 2", "text": "Text 2"}
|
| 73 |
-
]
|
| 74 |
-
}'
|
| 75 |
-
```
|
| 76 |
-
|
| 77 |
-
## Environment Variables
|
| 78 |
-
|
| 79 |
-
- `MODEL_PATH`: Path to the model file (default: `fake_news_model.joblib`)
|
| 80 |
-
- `API_KEY`: API key for authentication (default: `super-secret-key`)
|
| 81 |
-
|
| 82 |
-
## License
|
| 83 |
-
|
| 84 |
-
Apache 2.0
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: SVM Fake News Classifier
|
| 3 |
+
emoji: π°
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
+
app_file: gradio_app.py
|
| 9 |
+
app_port: 7860
|
| 10 |
+
pinned: false
|
| 11 |
+
license: apache-2.0
|
| 12 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README_HF.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: SVM Fake News Classifier
|
| 3 |
-
emoji: π°
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: docker
|
| 7 |
-
app_port: 7860
|
| 8 |
-
pinned: false
|
| 9 |
-
license: apache-2.0
|
| 10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README_gradio.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: SVM Fake News Classifier
|
| 3 |
-
emoji: π°
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: "4.44.0"
|
| 8 |
-
app_file: gradio_app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: apache-2.0
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# SVM Fake News Classifier
|
| 14 |
-
|
| 15 |
-
An interactive web application for classifying news articles as real or fake using Support Vector Machine with TF-IDF features.
|
| 16 |
-
|
| 17 |
-
## Features
|
| 18 |
-
|
| 19 |
-
- π€ **SVM Model**: Support Vector Machine with TF-IDF vectorization
|
| 20 |
-
- π **Calibrated Probabilities**: Reliable confidence scores using CalibratedClassifierCV
|
| 21 |
-
- π― **Interactive Interface**: User-friendly Gradio web interface
|
| 22 |
-
- π **Example Articles**: Pre-loaded examples to test the model
|
| 23 |
-
- π **Confidence Levels**: High/Medium/Low confidence indicators
|
| 24 |
-
|
| 25 |
-
## How to Use
|
| 26 |
-
|
| 27 |
-
1. **Enter Article Details**: Input the news title and content
|
| 28 |
-
2. **Get Prediction**: Click "Classify News" to analyze the article
|
| 29 |
-
3. **Review Results**: Check the prediction, probabilities, and confidence level
|
| 30 |
-
|
| 31 |
-
## Model Information
|
| 32 |
-
|
| 33 |
-
- **Algorithm**: Support Vector Machine (SVM)
|
| 34 |
-
- **Features**: TF-IDF text vectorization
|
| 35 |
-
- **Calibration**: CalibratedClassifierCV for probability estimates
|
| 36 |
-
- **Output**: Binary classification (Real/Fake) with confidence scores
|
| 37 |
-
|
| 38 |
-
## API Version
|
| 39 |
-
|
| 40 |
-
For programmatic access, a FastAPI version is also available with the following endpoints:
|
| 41 |
-
- `POST /predict` - Single article prediction
|
| 42 |
-
- `POST /predict_batch` - Batch predictions
|
| 43 |
-
- `GET /health` - Health check
|
| 44 |
-
|
| 45 |
-
## Disclaimer
|
| 46 |
-
|
| 47 |
-
This is a machine learning model for educational and research purposes. Always verify important information through multiple reliable sources.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|