A repository for Morocco Princing API model Microservice using FastAPI , alongside with 3 other AI Features
# Morocco Airbnb Dynamic Pricing API
AI-powered dynamic pricing microservice for Airbnb listings across Moroccan cities. Predicts optimal nightly prices using a Random Forest model trained on 1,656+ real listings.
## Overview
This API delivers real-time price predictions for short-term rental properties in Morocco's major cities. Built with **FastAPI** and powered by a **Random Forest** machine learning model achieving **84.59 MAD mean absolute error** (~$8.46 USD).
### Key Features
- **Fast Predictions**: Single prediction ` - Specific build
- `medgm/morocco-pricing-api: ` - Git commit version
---
## Project Structure
```
pricing-model-api/
├── data/
│ ├── raw/ # Raw JSON listings
│ ├── processed/ # Processed datasets
│ └── used_or_will_be_used/
│ └── all_listings_clean.csv # Clean dataset (1,656 listings)
├── deployment/
│ ├── Dockerfile # Production Docker image
│ ├── Jenkinsfile # CI/CD pipeline
│ ├── app.py # FastAPI application
│ ├── docker-compose.yml # Docker Compose config
│ ├── requirements.txt # Python dependencies
│ └── test_api.py # API tests
├── models/
│ ├── production/
│ │ └── random_forest_tuned.pkl.gz # Trained model (~94.55 MB compressed)
│ ├── model_comparison.csv # Training metrics summary
│ └── rf_feature_importance.csv # Random Forest feature importances
├── notebooks/
│ ├── airbnb_pricing_pipeline.ipynb # ETL pipeline
│ └── pricing_model_training.ipynb # Model training
└── README.md # This file
```
---
## Technology Stack
### Backend
- **Framework**: FastAPI 0.115.6
- **Server**: Uvicorn (ASGI)
- **Validation**: Pydantic v2
### Machine Learning
- **Algorithm**: RandomForestRegressor
- **Library**: scikit-learn 1.7.2
- **Model Size**: 94.55 MB (compressed)
- **Feature Space**: …