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 +