Refactor Vosk service startup script to use start_with_deps.sh for both async and Gunicorn modes
This commit is contained in:
34
vosk/test_files/fix_flask_error.sh
Normal file
34
vosk/test_files/fix_flask_error.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quick fix for Flask module error
|
||||
|
||||
echo "🔧 Fixing Flask module error..."
|
||||
|
||||
# Navigate to vosk_service directory
|
||||
cd ../vosk_service
|
||||
|
||||
# Make the startup script executable
|
||||
chmod +x start_with_deps.sh
|
||||
|
||||
# Install dependencies
|
||||
echo "📦 Installing dependencies..."
|
||||
pip install Flask>=2.3.0
|
||||
pip install aiohttp>=3.8.0
|
||||
pip install gunicorn>=21.0.0
|
||||
pip install vosk>=0.3.45
|
||||
pip install soundfile>=0.12.1
|
||||
pip install numpy>=1.24.0
|
||||
pip install requests>=2.31.0
|
||||
|
||||
# Test if Flask is now available
|
||||
echo "🧪 Testing Flask import..."
|
||||
python -c "import flask; print('✅ Flask imported successfully!')"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "🎯 Flask module error fixed!"
|
||||
echo "💡 You can now run the service with:"
|
||||
echo " cd vosk/vosk_service"
|
||||
echo " ./start_with_deps.sh"
|
||||
else
|
||||
echo "❌ Flask import still failing. Please check your Python environment."
|
||||
fi
|
||||
@@ -48,13 +48,13 @@ if ! curl -s http://localhost:5000/ > /dev/null; then
|
||||
# Choose between async and production mode
|
||||
if [ "$USE_ASYNC" = "true" ]; then
|
||||
export USE_ASYNC=true
|
||||
python start_service.py &
|
||||
./start_with_deps.sh &
|
||||
VOSK_PID=$!
|
||||
echo "✅ Vosk async service started with PID: $VOSK_PID"
|
||||
else
|
||||
# Use Gunicorn for production multiprocessing
|
||||
export USE_GUNICORN=true
|
||||
gunicorn -c gunicorn_config.py app_optimized:app &
|
||||
./start_with_deps.sh &
|
||||
VOSK_PID=$!
|
||||
echo "✅ Vosk Gunicorn service started with PID: $VOSK_PID"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user