Merge remote-tracking branch 'origin/master'
# Conflicts: # .env.example # README.md # app.py # docker-compose.yml
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
Generated
+12
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
|
<option name="metadata">
|
||||||
|
<MTProjectMetadataState>
|
||||||
|
<option name="migrated" value="true" />
|
||||||
|
<option name="pristineConfig" value="false" />
|
||||||
|
<option name="userId" value="-6077f146:198b84bb7ea:-7ffe" />
|
||||||
|
</MTProjectMetadataState>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.13 (simple-asr-server)" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (simple-asr-server)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="PyDocumentationSettings">
|
||||||
|
<option name="format" value="PLAIN" />
|
||||||
|
<option name="myDocStringFormat" value="Plain" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
+30
-9
@@ -1,22 +1,43 @@
|
|||||||
FROM rocm/pytorch:rocm6.4.1_ubuntu22.04_py3.10_pytorch_release_2.6.0
|
# Use official Python image as base
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
python3-venv \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Update pip
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
|
# Copy requirements first for better caching
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir --default-timeout=100 -r requirements.txt
|
|
||||||
|
|
||||||
COPY . .
|
# Install Python dependencies
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy application code
|
||||||
|
COPY app.py .
|
||||||
|
|
||||||
|
# Create directory for models and keys
|
||||||
|
RUN mkdir -p /app/models /app/data
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV MODEL_DOWNLOAD_ROOT=/app/models
|
||||||
|
ENV KEYS_FILE=/app/data/keys.txt
|
||||||
|
|
||||||
|
# Expose port
|
||||||
EXPOSE 9854
|
EXPOSE 9854
|
||||||
|
|
||||||
# Устанавливаем переменные окружения для ROCm
|
# Health check
|
||||||
ENV HSA_OVERRIDE_GFX_VERSION=10.3.0
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||||
ENV PYTORCH_ROCM_ARCH=gfx1030
|
CMD curl -f http://localhost:9854/health || exit 1
|
||||||
|
|
||||||
# Команда для запуска приложения
|
# Run the application
|
||||||
CMD ["python3", "app.py"]
|
CMD ["python", "app.py"]
|
||||||
|
|||||||
+4
-5
@@ -1,8 +1,7 @@
|
|||||||
fastapi
|
fastapi
|
||||||
uvicorn[standard]
|
uvicorn[standard]
|
||||||
python-multipart
|
python-multipart
|
||||||
gigaam
|
openai-whisper
|
||||||
gigaam[longform]
|
python-dotenv
|
||||||
ffmpeg-python
|
|
||||||
PyYAML
|
|
||||||
numpy<2.0.0
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Whisper ASR Server (ROCM)
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=exec
|
||||||
|
User=asr
|
||||||
|
Group=asr
|
||||||
|
WorkingDirectory=/opt/asr
|
||||||
|
ExecStart=/opt/asr/start_server.sh
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
SyslogIdentifier=asr
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Executable
+64
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Simple ASR Server startup script for systemd
|
||||||
|
# This script loads environment variables from .env file and starts the server
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Get the directory where this script is located
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
APP_DIR="${SCRIPT_DIR}"
|
||||||
|
|
||||||
|
# Load environment variables from .env file if it exists
|
||||||
|
if [ -f "${APP_DIR}/.env" ]; then
|
||||||
|
echo "Loading environment variables from ${APP_DIR}/.env"
|
||||||
|
set -a # automatically export all variables
|
||||||
|
source "${APP_DIR}/.env"
|
||||||
|
set +a
|
||||||
|
else
|
||||||
|
echo "Warning: .env file not found at ${APP_DIR}/.env"
|
||||||
|
echo "Using default environment variables"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set default values if not provided in .env
|
||||||
|
export HOST=${HOST:-"0.0.0.0"}
|
||||||
|
export PORT=${PORT:-9854}
|
||||||
|
export DEFAULT_MODEL=${DEFAULT_MODEL:-"turbo"}
|
||||||
|
export MODEL_DOWNLOAD_ROOT=${MODEL_DOWNLOAD_ROOT:-"${APP_DIR}/models"}
|
||||||
|
export KEYS_FILE=${KEYS_FILE:-"${APP_DIR}/keys.txt"}
|
||||||
|
export LOG_LEVEL=${LOG_LEVEL:-"INFO"}
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
mkdir -p "${MODEL_DOWNLOAD_ROOT}"
|
||||||
|
mkdir -p "$(dirname "${KEYS_FILE}")"
|
||||||
|
|
||||||
|
# Check if virtual environment exists, create if not
|
||||||
|
VENV_DIR="${APP_DIR}/venv"
|
||||||
|
if [ ! -d "${VENV_DIR}" ]; then
|
||||||
|
echo "Creating virtual environment..."
|
||||||
|
python3 -m venv "${VENV_DIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate virtual environment
|
||||||
|
echo "Activating virtual environment..."
|
||||||
|
source "${VENV_DIR}/bin/activate"
|
||||||
|
|
||||||
|
# Install/upgrade dependencies
|
||||||
|
echo "Installing/upgrading dependencies..."
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r "${APP_DIR}/requirements.txt"
|
||||||
|
|
||||||
|
# Change to app directory
|
||||||
|
cd "${APP_DIR}"
|
||||||
|
|
||||||
|
echo "Starting Simple ASR Server..."
|
||||||
|
echo "Host: ${HOST}"
|
||||||
|
echo "Port: ${PORT}"
|
||||||
|
echo "Default Model: ${DEFAULT_MODEL}"
|
||||||
|
echo "Model Download Root: ${MODEL_DOWNLOAD_ROOT}"
|
||||||
|
echo "Keys File: ${KEYS_FILE}"
|
||||||
|
echo "Log Level: ${LOG_LEVEL}"
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
exec python3 app.py
|
||||||
|
|
||||||
Reference in New Issue
Block a user