hmusman2804045-max commited on
Commit ·
589bbef
1
Parent(s): 18026f5
Update README to reflect Phase 5 completion
Browse files
README.md
CHANGED
|
@@ -2,16 +2,22 @@
|
|
| 2 |
|
| 3 |
Welcome to the Urdu Sentiment and Emotion Analysis Engine project! This repository contains the code for a multilingual NLP system that classifies sentiment (Positive, Negative, Neutral) and emotion (Joy, Anger, Fear, Sadness) from Urdu, Roman Urdu, and mixed-language text using a fine-tuned XLM-RoBERTa transformer.
|
| 4 |
|
| 5 |
-
##
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
### Repository Structure
|
| 9 |
-
- `
|
|
|
|
|
|
|
|
|
|
| 10 |
- `training/`: Contains the core scripts for data processing and model fine-tuning.
|
| 11 |
-
- `dataset.py`: PyTorch `Dataset` implementation for loading and tokenizing text
|
| 12 |
-
- `train_sentiment.py`: Training script for the sentiment classification model.
|
| 13 |
-
- `train_emotion.py`: Training script for the emotion classification model.
|
| 14 |
-
- `
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
### Environment Setup
|
| 17 |
To get started, create a virtual environment and install the required dependencies:
|
|
@@ -30,7 +36,12 @@ source urdu_env/bin/activate
|
|
| 30 |
pip install -r requirements.txt
|
| 31 |
```
|
| 32 |
|
| 33 |
-
###
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
| 2 |
|
| 3 |
Welcome to the Urdu Sentiment and Emotion Analysis Engine project! This repository contains the code for a multilingual NLP system that classifies sentiment (Positive, Negative, Neutral) and emotion (Joy, Anger, Fear, Sadness) from Urdu, Roman Urdu, and mixed-language text using a fine-tuned XLM-RoBERTa transformer.
|
| 4 |
|
| 5 |
+
## Current Progress: Phase 5 (Backend Complete)
|
| 6 |
+
The project has successfully completed Phases 1 through 5. The models have been fully trained on GPU clusters, critical label-mapping alignments have been applied across Urdu/Roman datasets, and the models are now integrated into a functional REST API using Flask.
|
| 7 |
+
|
| 8 |
+
### Repository Structure
|
| 9 |
+
- `app.py`: The Flask Web Server that exposes the `/predict` REST API endpoint.
|
| 10 |
+
- `predictor.py`: Object-Oriented class handling the safe loading and inference of the XLM-RoBERTa models.
|
| 11 |
+
- `requirements.txt`: Environment dependencies required for training and the web server.
|
| 12 |
+
- `test_models.py`: A utility script to run interactive CLI inference without starting the server.
|
| 13 |
- `training/`: Contains the core scripts for data processing and model fine-tuning.
|
| 14 |
+
- `dataset.py`: PyTorch `Dataset` implementation for loading and tokenizing text, now utilizing unified canonical label mappings.
|
| 15 |
+
- `train_sentiment.py`: Training script for the sentiment classification model (Multi-GPU enabled).
|
| 16 |
+
- `train_emotion.py`: Training script for the emotion classification model (Multi-GPU enabled).
|
| 17 |
+
- `evaluation/`: Scripts for evaluating model performance and generating attention visualizations.
|
| 18 |
+
- `results/`: Contains output matrices and evaluation reports.
|
| 19 |
+
|
| 20 |
+
*(Note: The `models/` directory containing the 1GB `.safetensors` files is ignored via `.gitignore` due to size constraints. The models must be downloaded from the training environment and placed locally to run the API.)*
|
| 21 |
|
| 22 |
### Environment Setup
|
| 23 |
To get started, create a virtual environment and install the required dependencies:
|
|
|
|
| 36 |
pip install -r requirements.txt
|
| 37 |
```
|
| 38 |
|
| 39 |
+
### Running the API Server
|
| 40 |
+
To start the backend server and test predictions:
|
| 41 |
+
```bash
|
| 42 |
+
python app.py
|
| 43 |
+
```
|
| 44 |
+
The server will boot up and listen on `http://127.0.0.1:5000`. You can send POST requests to `/predict` containing `{"text": "your urdu text"}` to receive JSON sentiment/emotion scores.
|
| 45 |
|
| 46 |
+
### Next Steps (Phase 6)
|
| 47 |
+
The upcoming Phase 6 will involve building the UI/Frontend (HTML/CSS/JS) to interact beautifully with the `app.py` backend!
|