Minimal refactor of your single-file server into a small package.
Quick start
- Create and activate a virtual environment (Windows PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt- Run the server (binds to all interfaces by default):
python WebServer.pyFiles added
pashto_stt/asr.py— ASR model wrapperpashto_stt/audio.py— small helper to parse Gradio audio tuplespashto_stt/ui.py— builds the Gradio interfaceapp.py— application entrypointWebServer.py— lightweight compatibility wrapper
Background-music removal
pashto_stt.audio now offers remove_background_music(data, sample_rate, method="auto").
- Method
autowill try thedemucsCLI (recommended) if installed and fall back tonoisereducespectral gating otherwise. - To use Demucs install it separately (it is optional and may require
ffmpeg):
pip install demucs
# and ensure ffmpeg is installed on PATHIf you don't install Demucs, the repo will use noisereduce for a lightweight
noise-reduction fallback.