Skip to content

Commit 3c772b2

Browse files
dittopsclaude
authored andcommitted
Polylingua Translation service (opea-project#2298)
Signed-off-by: dittops <dittops@gmail.com> Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: cogniware-devops <ambarish.desai@cogniware.ai>
1 parent 8675d9a commit 3c772b2

36 files changed

+3152
-0
lines changed

PolyLingua/.env.example

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# ================================================
2+
# PolyLingua Environment Configuration
3+
# ================================================
4+
# Copy this file to .env and update with your values
5+
# Run: cp .env.example .env
6+
# Then edit .env with your actual configuration
7+
8+
# ================================================
9+
# HuggingFace Configuration
10+
# ================================================
11+
# Required: Get your token from https://huggingface.co/settings/tokens
12+
# This is needed to download models from HuggingFace Hub
13+
HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14+
15+
# ================================================
16+
# Model Configuration
17+
# ================================================
18+
# LLM model ID from HuggingFace
19+
# Default model supports multilingual translation
20+
LLM_MODEL_ID=swiss-ai/Apertus-8B-Instruct-2509
21+
22+
# Directory to cache downloaded models
23+
# Models can be large (several GB), ensure sufficient disk space
24+
MODEL_CACHE=./data
25+
26+
# ================================================
27+
# Host Configuration
28+
# ================================================
29+
# Your server/machine IP address
30+
# Use 'localhost' for local development
31+
# Use actual IP (e.g., 192.168.1.100) for network access
32+
host_ip=localhost
33+
34+
# ================================================
35+
# Backend Service Configuration
36+
# ================================================
37+
# vLLM (vLLM Inference) endpoint
38+
# This is the LLM inference service endpoint
39+
VLLM_ENDPOINT=http://localhost:8028
40+
41+
# LLM microservice configuration
42+
# Host and port for the LLM microservice
43+
LLM_SERVICE_HOST_IP=localhost
44+
LLM_SERVICE_PORT=9000
45+
46+
# PolyLingua megaservice configuration
47+
# Main translation service host and port
48+
MEGA_SERVICE_HOST_IP=localhost
49+
MEGA_SERVICE_PORT=8888
50+
51+
# Backend service details
52+
BACKEND_SERVICE_NAME=polylingua
53+
BACKEND_SERVICE_IP=localhost
54+
BACKEND_SERVICE_PORT=8888
55+
56+
# ================================================
57+
# Frontend Configuration
58+
# ================================================
59+
# Backend endpoint URL for the frontend
60+
# This is what the UI uses to connect to the backend
61+
BACKEND_SERVICE_ENDPOINT=http://localhost:8888
62+
63+
# Frontend service configuration
64+
# Next.js development server configuration
65+
FRONTEND_SERVICE_IP=localhost
66+
FRONTEND_SERVICE_PORT=5173
67+
68+
# ================================================
69+
# Docker Configuration
70+
# ================================================
71+
# Docker registry for pulling images
72+
# Use 'opea' for official OPEA images
73+
REGISTRY=opea
74+
75+
# Docker image tag
76+
# Use 'latest' for most recent version
77+
TAG=latest
78+
79+
# ================================================
80+
# Nginx Configuration
81+
# ================================================
82+
# Nginx reverse proxy port
83+
# Default HTTP port
84+
NGINX_PORT=80
85+
86+
# ================================================
87+
# Proxy Settings (Optional)
88+
# ================================================
89+
# Configure if behind a corporate proxy
90+
# Leave empty if not using a proxy
91+
92+
# HTTP proxy URL (e.g., http://proxy.company.com:8080)
93+
http_proxy=
94+
95+
# HTTPS proxy URL (e.g., http://proxy.company.com:8080)
96+
https_proxy=
97+
98+
# Comma-separated list of hosts to bypass proxy
99+
no_proxy=localhost,127.0.0.1
100+
101+
# ================================================
102+
# Quick Start Guide
103+
# ================================================
104+
#
105+
# 1. Copy this file:
106+
# cp .env.example .env
107+
#
108+
# 2. Edit .env and set your HF_TOKEN
109+
#
110+
# 3. Update host_ip if deploying to network
111+
# (use actual IP instead of localhost)
112+
#
113+
# 4. Start services:
114+
# docker compose up -d
115+
#
116+
# 5. Access UI at:
117+
# http://localhost:5173 (or http://<host_ip>:5173)
118+
#
119+
# ================================================

PolyLingua/.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Environment variables
2+
.env
3+
.env.local
4+
5+
# Python
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
*.so
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
# Python library directories (but allow ui/lib)
18+
/lib/
19+
/lib64/
20+
!ui/lib/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
29+
# Virtual environments
30+
venv/
31+
env/
32+
ENV/
33+
.venv
34+
35+
# Model cache
36+
data/
37+
models/
38+
*.bin
39+
*.safetensors
40+
41+
# IDEs
42+
.vscode/
43+
.idea/
44+
*.swp
45+
*.swo
46+
*~
47+
48+
# OS
49+
.DS_Store
50+
Thumbs.db
51+
52+
# Logs
53+
*.log
54+
logs/
55+
56+
# Temporary files
57+
tmp/
58+
temp/
59+
*.tmp
60+
61+
# Node modules (for UI)
62+
ui/node_modules/
63+
ui/.next/
64+
ui/out/
65+
ui/build/
66+
67+
# Docker
68+
docker-compose.override.yml

PolyLingua/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM python:3.11-slim
5+
6+
WORKDIR /home/user
7+
8+
# Install system dependencies
9+
RUN apt-get update && apt-get install -y --no-install-recommends \
10+
curl \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Copy requirements and install Python dependencies
14+
COPY requirements.txt .
15+
RUN pip install --no-cache-dir --upgrade pip && \
16+
pip install --no-cache-dir -r requirements.txt
17+
18+
# Copy polylingua service
19+
COPY polylingua.py .
20+
21+
# Expose service port
22+
EXPOSE 8888
23+
24+
# Run the polylingua service
25+
ENTRYPOINT ["python", "polylingua.py"]

0 commit comments

Comments
 (0)