CoolFace
Apppublic

AndroidGuy/Speaker-Diarization

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Real-Time Speaker Diarization

This project implements real-time speaker diarization using WebRTC, FastAPI, and Gradio. It automatically transcribes speech and identifies different speakers in real-time.

Architecture

The system is split into two components:

  1. 1.Model Server (Hugging Face Space): Runs the speech recognition and speaker diarization models
  2. 2.Signaling Server (Render): Handles WebRTC signaling for direct audio streaming from browser

Deployment Instructions

Deploy Model Server on Hugging Face Space

  1. 1.Create a new Space on Hugging Face (Docker SDK)
  2. 2.Upload all files from the Speaker-Diarization directory
  3. 3.In Space settings:
  4. 4.Set Hardware to CPU (or GPU if available)
  5. 5.Set the public visibility
  6. 6.Environment: Make sure Docker SDK is selected

Deploy Signaling Server on Render

  1. 1.Create a new Render Web Service
  2. 2.Connect to your GitHub repo containing the render-signal directory
  3. 3.Configure Render service:
  4. 4.Set Build Command: cd render-signal && pip install -r requirements.txt
  5. 5.Set Start Command: cd render-signal && python backend.py
  6. 6.Select Environment: Python 3
  7. 7.Set Environment Variables:
  8. 8.HF_SPACE_URL: Set to your Hugging Face Space URL (e.g., your-username-speaker-diarization.hf.space)

Update Configuration

After both services are deployed:

  1. 1.Update ui.py on your Hugging Face Space:
  2. 2.Change RENDER_SIGNALING_URL to your Render app URL (wss://your-app.onrender.com/stream)
  3. 3.Make sure HF_SPACE_URL matches your actual Hugging Face Space URL
  1. 1.Update backend.py on your Render service:
  2. 2.Set API_WS to your Hugging Face Space WebSocket URL (wss://your-username-speaker-diarization.hf.space/ws_inference)

Usage

  1. 1.Open your Hugging Face Space URL in a web browser
  2. 2.Click "Start Listening" to begin
  3. 3.Speak into your microphone
  4. 4.The system will transcribe your speech and identify different speakers in real-time

Technology Stack

  • Frontend: Gradio UI with WebRTC for audio streaming
  • Signaling: FastRTC on Render for WebRTC signaling
  • Backend: FastAPI + WebSockets
  • Models:
  • SpeechBrain ECAPA-TDNN for speaker embeddings
  • Automatic Speech Recognition for transcription

License

MIT