This is a speech transcription application that uses Gradio for the user interface and Hugging Face's Transformers library for speech-to-text and text analysis.
- Transcribe audio using the
openai/whisper-tiny.en
model. - Analyze transcriptions using the
TinyLlama/TinyLlama-1.1B-Chat-v1.0
model. - Simple and intuitive user interface built with Gradio.
- Python 3.11
- Homebrew (for macOS users)
If you don't have Homebrew installed, you can install it using the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install [email protected]
Navigate to your project directory and create a virtual environment:
cd /path/to/speech-analyzer
python3.11 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
brew install pkg-config
brew install protobuf
brew install sentencepiece
Set the PKG_CONFIG_PATH
environment variable:
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH"
Create a requirements.txt
file with the following content:
torch>=2.1.0
torchvision>=0.16.0
torchaudio>=2.1.0
transformers==4.35.2
gradio==3.50.2
pyaudio==0.2.13
sentencepiece
protobuf
Install the packages:
pip install -r
requirements.txt
### 7. Verify package installation
Confirm that `torch` and other packages are installed correctly:
```bash
python -c "import torch; print(torch.__version__)"
To run the application, use the following command:
python3
speech_analyzer.py
- Open the Gradio interface in your web browser.
- Upload an audio file or record audio directly.
- Click the "Transcribe" button to get the transcription.
- The transcription will be displayed in the interface.
If you encounter any issues, please ensure that all dependencies are installed correctly and that you are using Python 3.11. If problems persist, feel free to open an issue or contact the maintainer.
- Create new environment with Python 3.10:
python3.10 -m venv my_env
source my_env/bin/activate
- Install dependencies:
pip install --upgrade pip
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0
pip install gradio==4.44.1
pip install transformers==4.36.0
- Verify installations:
python3 -c "import torch; import gradio; import transformers; print(f'PyTorch: {torch.__version__}\nGradio: {gradio.__version__}\nTransformers: {transformers.__version__}')"
If Python 3.10 is not installed:
brew install [email protected]
Then repeat the steps above.