Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions PolyLingua/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# ================================================
# PolyLingua Environment Configuration
# ================================================
# Copy this file to .env and update with your values
# Run: cp .env.example .env
# Then edit .env with your actual configuration

# ================================================
# HuggingFace Configuration
# ================================================
# Required: Get your token from https://huggingface.co/settings/tokens
# This is needed to download models from HuggingFace Hub
HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# ================================================
# Model Configuration
# ================================================
# LLM model ID from HuggingFace
# Default model supports multilingual translation
LLM_MODEL_ID=swiss-ai/Apertus-8B-Instruct-2509

# Directory to cache downloaded models
# Models can be large (several GB), ensure sufficient disk space
MODEL_CACHE=./data

# ================================================
# Host Configuration
# ================================================
# Your server/machine IP address
# Use 'localhost' for local development
# Use actual IP (e.g., 192.168.1.100) for network access
host_ip=localhost

# ================================================
# Backend Service Configuration
# ================================================
# vLLM (vLLM Inference) endpoint
# This is the LLM inference service endpoint
VLLM_ENDPOINT=http://localhost:8028

# LLM microservice configuration
# Host and port for the LLM microservice
LLM_SERVICE_HOST_IP=localhost
LLM_SERVICE_PORT=9000

# PolyLingua megaservice configuration
# Main translation service host and port
MEGA_SERVICE_HOST_IP=localhost
MEGA_SERVICE_PORT=8888

# Backend service details
BACKEND_SERVICE_NAME=polylingua
BACKEND_SERVICE_IP=localhost
BACKEND_SERVICE_PORT=8888

# ================================================
# Frontend Configuration
# ================================================
# Backend endpoint URL for the frontend
# This is what the UI uses to connect to the backend
BACKEND_SERVICE_ENDPOINT=http://localhost:8888

# Frontend service configuration
# Next.js development server configuration
FRONTEND_SERVICE_IP=localhost
FRONTEND_SERVICE_PORT=5173

# ================================================
# Docker Configuration
# ================================================
# Docker registry for pulling images
# Use 'opea' for official OPEA images
REGISTRY=opea

# Docker image tag
# Use 'latest' for most recent version
TAG=latest

# ================================================
# Nginx Configuration
# ================================================
# Nginx reverse proxy port
# Default HTTP port
NGINX_PORT=80

# ================================================
# Proxy Settings (Optional)
# ================================================
# Configure if behind a corporate proxy
# Leave empty if not using a proxy

# HTTP proxy URL (e.g., http://proxy.company.com:8080)
http_proxy=

# HTTPS proxy URL (e.g., http://proxy.company.com:8080)
https_proxy=

# Comma-separated list of hosts to bypass proxy
no_proxy=localhost,127.0.0.1

# ================================================
# Quick Start Guide
# ================================================
#
# 1. Copy this file:
# cp .env.example .env
#
# 2. Edit .env and set your HF_TOKEN
#
# 3. Update host_ip if deploying to network
# (use actual IP instead of localhost)
#
# 4. Start services:
# docker compose up -d
#
# 5. Access UI at:
# http://localhost:5173 (or http://<host_ip>:5173)
#
# ================================================
68 changes: 68 additions & 0 deletions PolyLingua/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Environment variables
.env
.env.local

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
# Python library directories (but allow ui/lib)
/lib/
/lib64/
!ui/lib/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
env/
ENV/
.venv

# Model cache
data/
models/
*.bin
*.safetensors

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log
logs/

# Temporary files
tmp/
temp/
*.tmp

# Node modules (for UI)
ui/node_modules/
ui/.next/
ui/out/
ui/build/

# Docker
docker-compose.override.yml
25 changes: 25 additions & 0 deletions PolyLingua/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

FROM python:3.11-slim

WORKDIR /home/user

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

# Copy polylingua service
COPY polylingua.py .

# Expose service port
EXPOSE 8888

# Run the polylingua service
ENTRYPOINT ["python", "polylingua.py"]
Loading
Loading