Add Gunicorn support for production in Vosk service and update requirements

This commit is contained in:
Alireza
2025-08-02 17:52:11 +03:30
parent 0d151529f0
commit cfe2b2346a
7 changed files with 220 additions and 6 deletions

View File

@@ -267,5 +267,11 @@ if __name__ == '__main__':
app = create_async_app()
web.run_app(app, host='0.0.0.0', port=5000)
else:
# Run Flask version
app.run(host='0.0.0.0', port=5000, threaded=True, processes=4)
# Run Flask version with proper multiprocessing setup
# Use Gunicorn for production multiprocessing
if os.getenv('USE_GUNICORN', 'false').lower() == 'true':
# This will be handled by Gunicorn
app.run(host='0.0.0.0', port=5000)
else:
# Use threading for development
app.run(host='0.0.0.0', port=5000, threaded=True)