--- title: Audio Classification App emoji: ๐ŸŽง colorFrom: indigo colorTo: blue sdk: docker app_port: 8501 tags: - streamlit pinned: false --- # ๐ŸŽง Audio Classification App This Streamlit app allows you to upload `.wav` or `.mp3` audio files and get a classification prediction using either an **XGBoost** or **LightGBM** model. It uses pre-trained models and a full pipeline that includes audio preprocessing and feature extraction. ## ๐Ÿš€ How it Works 1. Upload your audio file (supports `.wav` or `.mp3`). 2. Select a model from the dropdown. 3. The app: - Preprocesses and extracts features from the audio. - Loads the selected model. - Returns the predicted class and inference time. ## ๐Ÿ“ฆ Technologies Used - `Streamlit` for the frontend - `librosa` and `soundfile` for audio handling - `LightGBM` and `XGBoost` for model inference - `scikit-learn` and `pandas` for data preprocessing ## ๐Ÿ›  Project Structure . โ”œโ”€โ”€ app.py # Streamlit app โ”œโ”€โ”€ requirements.txt # Dependencies โ”œโ”€โ”€ README.md # This file โ”œโ”€โ”€ models/ โ”‚ โ”œโ”€โ”€ xgboost.py โ”‚ โ””โ”€โ”€ lightgbm.py โ”œโ”€โ”€ modules/ โ”‚ โ”œโ”€โ”€ preprocessing.py โ”‚ โ””โ”€โ”€ feature_extraction.py ## ๐Ÿงช Inference Pipeline The app uses a modular inference pipeline built around: - `AudioPreprocessor`: for loading and cleaning audio signals - `FeatureExtractor`: for generating MFCC-based feature vectors - `ModelPipeline`: loads and predicts with the chosen model ## ๐Ÿ“„ Requirements Ensure the following packages are listed in `requirements.txt`: streamlit librosa xgboost lightgbm numpy pandas scikit-learn soundfile ## ๐Ÿ”— Resources - [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces) - [Streamlit Documentation](https://docs.streamlit.io/)