From d70f2e7089e29d6b3c4888e78adca54927241db0 Mon Sep 17 00:00:00 2001 From: red Date: Wed, 3 Sep 2025 10:50:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D0=B1=D0=BE=D1=80=20=D0=B2=D1=81?= =?UTF-8?q?=D1=8F=D0=BA=D0=B8=D1=85=20=D1=88=D1=82=D1=83=D0=BA=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B4=D0=B5=D0=BF=D0=BB=D0=BE=D1=8F.=20=D0=9F?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=BF=D0=BE=D0=BB=D0=B0=D0=B3=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D1=87=D1=82=D0=BE=20ROCM=20=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B8=D1=82=20=D0=BD=D0=B0=20=D1=85=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B5!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 19 ++++++++++++++----- .../inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/material_theme_project_new.xml | 12 ++++++++++++ .idea/misc.xml | 7 +++++++ .idea/vcs.xml | 6 ++++++ Dockerfile | 7 ++----- requirements.txt | 2 ++ start_server.sh | 17 +++++++++++++++++ 8 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/material_theme_project_new.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml mode change 100644 => 100755 start_server.sh diff --git a/.env.example b/.env.example index 73fcce6..779f616 100644 --- a/.env.example +++ b/.env.example @@ -1,13 +1,22 @@ + # Server configuration HOST=0.0.0.0 PORT=9854 # Model configuration -DEFAULT_MODEL=turbo -MODEL_DOWNLOAD_ROOT=/app/models +DEFAULT_MODEL=tiny +MODEL_DOWNLOAD_ROOT=./models -# API Keys -KEYS_FILE=/app/keys.txt +# Security configuration +KEYS_FILE=keys.txt -# Logging +# Logging configuration (optional) LOG_LEVEL=INFO + +# ROCm GPU configuration +HSA_OVERRIDE_GFX_VERSION=10.3.0 +ROCM_PATH=/opt/rocm + +# Example of available Whisper models: +# tiny, base, small, medium, large, turbo +# turbo is recommended for best speed/quality balance diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 0000000..a8dd540 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b79d30e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 57398d0..9b71450 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Use ROCm compatible Python image as base -FROM rocm/pytorch:rocm6.1_ubuntu22.04_py3.10_pytorch_2.1.2 +# Use official Python image as base +FROM python:3.10-slim # Set working directory WORKDIR /app @@ -31,8 +31,6 @@ RUN mkdir -p /app/models /app/data ENV PYTHONUNBUFFERED=1 ENV MODEL_DOWNLOAD_ROOT=/app/models ENV KEYS_FILE=/app/data/keys.txt -ENV HSA_OVERRIDE_GFX_VERSION=10.3.0 -ENV ROCM_PATH=/opt/rocm # Expose port EXPOSE 9854 @@ -43,4 +41,3 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ # Run the application CMD ["python", "app.py"] - diff --git a/requirements.txt b/requirements.txt index 217c4d8..c3f060d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,5 @@ uvicorn[standard] python-multipart openai-whisper python-dotenv + + diff --git a/start_server.sh b/start_server.sh old mode 100644 new mode 100755 index f354e2a..2ac7bf9 --- a/start_server.sh +++ b/start_server.sh @@ -32,6 +32,22 @@ export LOG_LEVEL=${LOG_LEVEL:-"INFO"} 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}" @@ -45,3 +61,4 @@ echo "Log Level: ${LOG_LEVEL}" # Start the application exec python3 app.py +