Spaces:
Sleeping
Sleeping
| ## ποΈ 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) |