Initial commit: Multilingual Translation API

- Implemented REST API for 105+ language translation
- Used Facebook M2M100 model (Apache 2.0 License - Commercial use allowed)
- Supports any-to-any translation between 105 languages
- Major languages: English, Chinese, Spanish, Arabic, Russian, Japanese, Korean, etc.
- Southeast Asian: Malay, Indonesian, Thai, Vietnamese, Tagalog, Burmese, Khmer, Lao
- South Asian: Bengali, Hindi, Urdu, Tamil, Telugu, Marathi, Gujarati, etc.
- European: German, French, Italian, Spanish, Portuguese, Russian, etc.
- African: Swahili, Amharic, Hausa, Igbo, Yoruba, Zulu, Xhosa
- And many more languages

Tech Stack:
- FastAPI for REST API
- Transformers (Hugging Face) for ML model
- PyTorch for inference
- Docker for containerization
- M2M100 418M parameter model

Features:
- Health check endpoint
- Supported languages listing
- Dynamic language validation
- Model caching for performance
- GPU support (auto-detection)
- CORS enabled for web clients

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
jungwoo choi
2025-11-10 14:11:20 +09:00
commit f586f930b6
13 changed files with 1011 additions and 0 deletions

27
app/config.py Normal file
View File

@ -0,0 +1,27 @@
from pydantic_settings import BaseSettings
from typing import List
class Settings(BaseSettings):
"""Application settings"""
# API Configuration
api_host: str = "0.0.0.0"
api_port: int = 8000
api_title: str = "Malaysian Language Translation API"
api_version: str = "1.0.0"
api_description: str = "API for translating between Malay and English using neural machine translation"
# Model Configuration
model_cache_dir: str = "./models"
max_length: int = 512
# CORS Settings
allowed_origins: List[str] = ["*"]
class Config:
env_file = ".env"
case_sensitive = False
settings = Settings()