Initial commit: mBART Translation API with Docker support
- FastAPI 기반 다국어 번역 REST API 서비스 - mBART-50 모델을 사용한 18개 언어 지원 - Docker 및 Docker Compose 설정 포함 - GPU/CPU 지원 - 헬스 체크 및 API 문서 자동 생성 - 외부 접속 지원 (172.30.1.2:8000) 주요 파일: - main.py: FastAPI 애플리케이션 - translator.py: mBART 번역 서비스 - models.py: Pydantic 데이터 모델 - config.py: 환경 설정 - Dockerfile: 최적화된 Docker 이미지 - docker-compose.yml: 간편한 배포 설정 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
38
config.py
Normal file
38
config.py
Normal file
@ -0,0 +1,38 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
class Config:
|
||||
"""Application configuration"""
|
||||
|
||||
# Server settings
|
||||
HOST: str = os.getenv("HOST", "0.0.0.0")
|
||||
PORT: int = int(os.getenv("PORT", "8000"))
|
||||
|
||||
# Model settings
|
||||
MODEL_NAME: str = os.getenv("MODEL_NAME", "facebook/mbart-large-50-many-to-many-mmt")
|
||||
MAX_LENGTH: int = int(os.getenv("MAX_LENGTH", "512"))
|
||||
DEVICE: str = os.getenv("DEVICE", "cpu")
|
||||
|
||||
# Supported languages for mBART-50
|
||||
SUPPORTED_LANGUAGES = {
|
||||
"ko": "ko_KR", # Korean
|
||||
"en": "en_XX", # English
|
||||
"ja": "ja_XX", # Japanese
|
||||
"zh": "zh_CN", # Chinese (Simplified)
|
||||
"es": "es_XX", # Spanish
|
||||
"fr": "fr_XX", # French
|
||||
"de": "de_DE", # German
|
||||
"ru": "ru_RU", # Russian
|
||||
"ar": "ar_AR", # Arabic
|
||||
"hi": "hi_IN", # Hindi
|
||||
"vi": "vi_VN", # Vietnamese
|
||||
"th": "th_TH", # Thai
|
||||
"id": "id_ID", # Indonesian
|
||||
"tr": "tr_TR", # Turkish
|
||||
"pt": "pt_XX", # Portuguese
|
||||
"it": "it_IT", # Italian
|
||||
"nl": "nl_XX", # Dutch
|
||||
"pl": "pl_PL", # Polish
|
||||
}
|
||||
|
||||
config = Config()
|
||||
Reference in New Issue
Block a user