Merge remote-tracking branch 'origin/master'
# Conflicts: # .env.example # README.md # app.py # docker-compose.yml
This commit is contained in:
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
12
.idea/material_theme_project_new.xml
generated
Normal file
12
.idea/material_theme_project_new.xml
generated
Normal file
@@ -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>
|
||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -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>
|
||||
7
.idea/simple-asr-server.iml
generated
Normal file
7
.idea/simple-asr-server.iml
generated
Normal file
@@ -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>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
39
Dockerfile
39
Dockerfile
@@ -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
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ffmpeg \
|
||||
git \
|
||||
curl \
|
||||
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 .
|
||||
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
|
||||
|
||||
# Устанавливаем переменные окружения для ROCm
|
||||
ENV HSA_OVERRIDE_GFX_VERSION=10.3.0
|
||||
ENV PYTORCH_ROCM_ARCH=gfx1030
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:9854/health || exit 1
|
||||
|
||||
# Команда для запуска приложения
|
||||
CMD ["python3", "app.py"]
|
||||
# Run the application
|
||||
CMD ["python", "app.py"]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
fastapi
|
||||
uvicorn[standard]
|
||||
python-multipart
|
||||
gigaam
|
||||
gigaam[longform]
|
||||
ffmpeg-python
|
||||
PyYAML
|
||||
numpy<2.0.0
|
||||
openai-whisper
|
||||
python-dotenv
|
||||
|
||||
|
||||
|
||||
20
simple-asr-server.service
Normal file
20
simple-asr-server.service
Normal file
@@ -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
|
||||
64
start_server.sh
Executable file
64
start_server.sh
Executable file
@@ -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