--- title: GLAM Web App emoji: 📈 colorFrom: green colorTo: purple sdk: gradio sdk_version: 6.18.0 python_version: '3.13' app_file: app.py pinned: false license: mit short_description: Respiratory monitoring model --- # GLAM Pipeline This repository includes a respiratory audio separation pipeline built around a local SepFormer model and a clinical reasoning/GNN inference path. ## Key Files ### model.py Loads the SepFormer separation model using local pretrained files in `pretrained_sepformer`. Wraps encoder/masknet/decoder into `UnifiedSepFormer`. ### interface.py Provides shared audio loading, separation, and saving helpers. Includes: * `separate_audio_file(...)` * `predict_sources(...)` * `save_separated_sources(...)` for pipeline reuse. Still supports the existing Gradio UI workflow via: * `separate_audio(...)` ### pipeline.py Runs separation over a directory of mixture audio files. Writes separated WAVs and waveform PNGs to an output folder. Produces: * `pipeline_summary.json` * `pipeline_summary.csv` ### gnn.py Defines the GNN model architecture used for respiratory audio reasoning. Provides utilities for: * loading a GNN checkpoint * estimating breathing rate * patient state tracking * clinical alert generation ### reasoning_pipeline.py Processes GNN run outputs: * `window_report.json` * `window_report.csv` Generates reasoning summary CSV/JSON files. Includes visualization helpers for per-patient summary plots. ### full_pipeline.py Runs the complete flow: 1. Separate mixture audio files 2. Run Wav2Vec2 + GNN inference 3. Save per-run artifacts 4. Aggregate reasoning summaries ## Running a Simulation To test the system using the provided sample data: 1. Open the Patient Registration page. 2. Navigate to the Sample_Audio folder. 3. Upload S1, S2, and S3 as individual patient recordings. 4. Click Register to register each patient. Next: 1. Open the Separation page. 2. Upload Sample_0_mix.wav from the Sample_Audio folder as the mixed audio recording. 3. Select the registered patients (S1, S2, and S3). 4. Click Run Separation. Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference