GenAIHub
Back to Labs
Intermediate

AI Meeting Summarizer

Build a tool to record, transcribe, and summarize your meetings automatically using OpenAI Whisper and GPT-4.

How it Works

1. Capture

Records audio in chunks using Python's `sounddevice`.

2. Transcribe

Converts speech to text using OpenAI Whisper API.

3. Summarize

GPT-4 creates structured Minutes & Action Items.

Step 1: Environment Setup

We recommend running this lab locally to ensure access to your microphone. You can use Poetry (recommended) or standard Pip. Docker is supported but has experimental microphone access on Mac/Windows.

Prerequisites

1. Python 3.10+ installed.
2. PortAudio installed (Mac: brew install portaudio).
3. Poetry installed (pip install poetry).

1. Install Dependencies

cd Handson/VoiceChatbot
poetry install

2. Run the App

poetry run streamlit run app.py

Core Logic

Recording and Transcription Loop

We record audio in 60-second blocks (or less) and send it to a thread for transcription to keep the UI responsive.

def record_in_blocks(...):
    # Records blocks of audio
    audio_block = np.concatenate(block_frames, axis=0)
    path = save_wav(audio_block)
    
    # Sends to Whisper in a separate thread
    threading.Thread(target=transcribe_wav, args=(path, results_queue)).start()
    
def transcribe_wav(path, results_queue):
    with open(path, "rb") as f:
        # Calls OpenAI Whisper API
        transcript = client.audio.transcriptions.create(
            model="whisper-1", 
            file=f, 
            language=chosen_language
        )
        results_queue.put((path, transcript.text))

Generating the Summary (GPT-4)

Once the meeting is over, we send the full text to GPT-4 with a specific system prompt to format it as "official minutes".

base_prompt = """
    Generate a detailed summary including:
    1. **Topics:** Grouped by subject.
    2. **Decisions/Actions:** With owners and deadlines.
    3. **General Summary:** Objective consolidation.
    
    Meeting transcription:
    {full_text}
"""

completion = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a specialist in crafting detailed meeting minutes."},
        {"role": "user", "content": base_prompt}
    ]
)

Download the complete project (including Docker & Poetry support).

Download Project (.zip)