import whisper import pyaudio import tkinter as tk # PyAudio config CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 # Create GUI root = tk.Tk() text_box = tk.Text(root) text_box.pack() # Load Whisper model = whisper.load_model("base") # Start audio stream p = pyaudio.PyAudio() stream = p.open(format=FORMAT, channels=CHANNELS, rate=RATE, input=True, frames_per_buffer=CHUNK) # Listen to mic in a loop while True: data = stream.read(CHUNK) text = model.transcribe(data)['text'] # Insert into GUI text_box.insert('end', text) text_box.see('end') root.update() stream.stop_stream() stream.close() p.terminate()