Spaces:
Running
Running
File size: 2,316 Bytes
b4f755d |
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 |
## ποΈ Project Structure
```
βββ app.py # Main FastAPI app entrypoint
βββ config.py # Configuration loader (.env, settings)
βββ features/
β βββ text_classifier/ # English (GPT-2) classifier
β β βββ controller.py
β β βββ inferencer.py
β β βββ model_loader.py
β β βββ preprocess.py
β β βββ routes.py
β βββ nepali_text_classifier/ # Nepali (sentencepiece) classifier
β βββ controller.py
β βββ inferencer.py
β βββ model_loader.py
β βββ preprocess.py
β βββ routes.py
βββ np_text_model/ # Nepali model artifacts (auto-downloaded)
β βββ classifier/
β β βββ sentencepiece.bpe.model
β βββ model_95_acc.pth
βββ models/ # English GPT-2 model/tokenizer (auto-downloaded)
β βββ merges.txt
β βββ tokenizer.json
β βββ model_weights.pth
βββ Dockerfile # Container build config
βββ Procfile # Deployment entrypoint (for PaaS)
βββ requirements.txt # Python dependencies
βββ README.md
βββ Docs # documents
βββ .env # Secret token(s), environment config
```
### π Key Files and Their Roles
- **`app.py`**: Entry point initializing FastAPI app and routes.
- **`Procfile`**: Tells Railway (or similar platforms) how to run the program.
- **`requirements.txt`**: Tracks all Python dependencies for the project.
- **`__init__.py`**: Package initializer for the root module and submodules.
- **`features/text_classifier/`**
- **`controller.py`**: Handles logic between routes and the model.
- **`inferencer.py`**: Runs inference and returns predictions as well as file system
utilities.
- **`features/NP/`**
- **`controller.py`**: Handles logic between routes and the model.
- **`inferencer.py`**: Runs inference and returns predictions as well as file system
utilities.
- **`model_loader.py`**: Loads the ML model and tokenizer.
- **`preprocess.py`**: Prepares input text for the model.
- **`routes.py`**: Defines API routes for text classification.
-[Main](../README.md) |