Features: - OpenAI Whisper for audio transcription - DeepL API for translation (30+ languages) - Multiple output formats: TXT, VTT, SRT - Flask Python API backend - PHP frontend with black/gold theme - Support for 350MB files - Generates both original and translated files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
84 lines
2.2 KiB
Bash
Executable file
84 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Setup script for Voice to Text Whisper API
|
|
|
|
echo "==================================="
|
|
echo "Voice to Text - Setup Script"
|
|
echo "==================================="
|
|
echo ""
|
|
|
|
# Check if Python 3 is installed
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "Error: Python 3 is not installed. Please install Python 3.8 or higher."
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
|
|
echo "Python 3 found: Python $PYTHON_VERSION"
|
|
|
|
# Check if Python version is too new (3.12+)
|
|
PYTHON_MAJOR=$(python3 -c 'import sys; print(sys.version_info[0])')
|
|
PYTHON_MINOR=$(python3 -c 'import sys; print(sys.version_info[1])')
|
|
|
|
if [ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -ge 12 ]; then
|
|
echo ""
|
|
echo "WARNING: Python 3.12+ detected. Some packages may have compatibility issues."
|
|
echo "Recommended: Use Python 3.10 or 3.11 for best compatibility."
|
|
echo ""
|
|
read -p "Continue anyway? (y/n) " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Remove old venv if exists
|
|
if [ -d "venv" ]; then
|
|
echo "Removing old virtual environment..."
|
|
rm -rf venv
|
|
fi
|
|
|
|
# Determine which Python to use
|
|
if command -v python3.11 &> /dev/null; then
|
|
PYTHON_CMD=python3.11
|
|
echo "Using Python 3.11"
|
|
elif command -v python3.10 &> /dev/null; then
|
|
PYTHON_CMD=python3.10
|
|
echo "Using Python 3.10"
|
|
else
|
|
PYTHON_CMD=python3
|
|
echo "Using default Python 3"
|
|
fi
|
|
|
|
# Create virtual environment
|
|
echo "Creating virtual environment..."
|
|
$PYTHON_CMD -m venv venv
|
|
|
|
# Activate virtual environment
|
|
echo "Activating virtual environment..."
|
|
source venv/bin/activate
|
|
|
|
# Upgrade pip
|
|
echo "Upgrading pip..."
|
|
pip install --upgrade pip
|
|
|
|
# Install dependencies
|
|
echo "Installing dependencies (this may take a few minutes)..."
|
|
pip install -r requirements.txt
|
|
|
|
# Create outputs directory
|
|
echo "Creating outputs directory..."
|
|
mkdir -p outputs
|
|
|
|
echo ""
|
|
echo "==================================="
|
|
echo "Setup complete!"
|
|
echo "==================================="
|
|
echo ""
|
|
echo "To start the API server:"
|
|
echo " 1. Activate the virtual environment: source venv/bin/activate"
|
|
echo " 2. Run the API: python api.py"
|
|
echo ""
|
|
echo "The API will run on http://localhost:5010"
|
|
echo ""
|