Skip to content

mustafaangi/speech-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Speech Analyzer

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.

Features

  • 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.

Requirements

  • Python 3.11
  • Homebrew (for macOS users)

Installation

1. Install Homebrew (macOS only)

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)"

2. Install Python 3.11

brew install [email protected]

3. Set up the virtual environment

Navigate to your project directory and create a virtual environment:

cd /path/to/speech-analyzer
python3.11 -m venv venv
source venv/bin/activate

4. Upgrade pip and install build tools

pip install --upgrade pip setuptools wheel

5. Install system dependencies

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"

6. Install Python packages

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__)"

Running the Application

To run the application, use the following command:

python3

speech_analyzer.py

Usage

  1. Open the Gradio interface in your web browser.
  2. Upload an audio file or record audio directly.
  3. Click the "Transcribe" button to get the transcription.
  4. The transcription will be displayed in the interface.

Troubleshooting

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.

Summary

  1. Create new environment with Python 3.10:
python3.10 -m venv my_env
source my_env/bin/activate
  1. 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
  1. 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages