Upload folder using huggingface_hub
Browse filesFiles changed (3)
7 unmodified lines89101112131422 unmodified lines373839404142437 unmodified linesapp_file: app.pypinned: falselicense: apache-2.0hardware: cpu-basictags:- track:backyard- sponsor:modal22 unmodified lines- **Base:** `openai/whisper-large-v3-turbo`- **Adapter:** [`pradachan/whisper-large-v3-turbo-disfluency-lora`](https://huggingface.co/pradachan/whisper-large-v3-turbo-disfluency-lora)- **Trained on:** [Modal](https://modal.com) serverless GPUs (LoRA fine-tuning and the probe/eval harness both ran on Modal).- **Hardware:** CPU (upgrade to t4-small or ZeroGPU for live transcription)The gallery examples are real results from the DisfluencySpeech test set, plus onehonest limitation. Vanilla Whisper already deletes most filler "um/uh" natively, so7 unmodified lines89101112131422 unmodified lines373839404142437 unmodified linesapp_file: app.pypinned: falselicense: apache-2.0suggested_hardware: zero-a10gtags:- track:backyard- sponsor:modal22 unmodified lines- **Base:** `openai/whisper-large-v3-turbo`- **Adapter:** [`pradachan/whisper-large-v3-turbo-disfluency-lora`](https://huggingface.co/pradachan/whisper-large-v3-turbo-disfluency-lora)- **Trained on:** [Modal](https://modal.com) serverless GPUs (LoRA fine-tuning and the probe/eval harness both ran on Modal).- **Hardware:** ZeroGPU (`@spaces.GPU`) — live transcription runs on an on-demand A10G.The gallery examples are real results from the DisfluencySpeech test set, plus onehonest limitation. Vanilla Whisper already deletes most filler "um/uh" natively, so
48 unmodified lines495051525354556 unmodified lines626364656667686970717273747576777879808182103 unmodified lines18618718818919019119219319419519619719819920020120234 unmodified lines2372382392402412422432442452462472482491 unmodified line2512522532542552562572582592602612622632642652662672682 unmodified lines271272273274275276277278279280281282283284285286287288289124 unmodified lines4144154164174184195 unmodified lines42542642742842943053 unmodified lines48448548648748848949049149249349449549649749849950050150250350460 unmodified lines56556656756856957057157257357457557657757857958058158258358458558658748 unmodified linesdef load_models():"""Load processor + both models once, on first GPU call. Returns a dict."""if _MODELS:return _MODELS6 unmodified linesprocessor = WhisperProcessor.from_pretrained(BASE)vanilla = WhisperForConditionalGeneration.from_pretrained(BASE, torch_dtype=dtype).to(device)vanilla.eval()tuned_base = WhisperForConditionalGeneration.from_pretrained(BASE, torch_dtype=dtype)tuned = PeftModel.from_pretrained(tuned_base, ADAPTER).to(device)tuned.eval()_MODELS.update(processor=processor,vanilla=vanilla,tuned=tuned,device=device,dtype=dtype,)103 unmodified lines@spaces.GPU(duration=60)def transcribe(audio_path):if not audio_path:return "", "", '<span class="fw-placeholder-text">Record or upload some speech to begin.</span>'m = load_models()audio = _load_audio_16k_mono(audio_path)vanilla_text = _decode(m["vanilla"], m["processor"], audio, m["device"], m["dtype"])tuned_text = _decode(m["tuned"], m["processor"], audio, m["device"], m["dtype"])return vanilla_text, tuned_text, diff_html(vanilla_text, tuned_text)34 unmodified lines.gradio-container .prose, .gradio-container p, .gradio-container span,.gradio-container label { color: var(--fw-ink-dark); }/* ---- hero ------------------------------------------------------------- */.fw-hero {background: var(--fw-card);border: 3px double var(--fw-royal-gold);border-radius: 8px;padding: 3rem 2.5rem;margin: 0.5rem 0 2.2rem;box-shadow: 0 4px 20px rgba(158,122,68,0.04);text-align: center;}1 unmodified linefont-family: 'Instrument Serif', serif;font-style: normal;text-transform: none;font-size: 1.25rem;font-weight: 600;color: var(--fw-royal-gold);margin: 0 0 1rem;}.fw-hero h1 {font-family: 'Instrument Serif', Georgia, serif !important;font-weight: 400 !important;font-size: 4rem !important;line-height: 1.05 !important;color: var(--fw-ink-dark) !important;margin: 0 0 0.8rem !important;font-style: normal !important;}.fw-hero h1 .fw-accent {2 unmodified lines}.fw-lede {font-family: 'Instrument Serif', Georgia, serif !important;font-size: 2rem !important;color: var(--fw-ink-muted) !important;margin: 0 0 1.2rem !important;}.fw-tagline {font-family: 'Newsreader', Georgia, serif !important;font-size: 1.15rem !important;line-height: 1.65 !important;color: var(--fw-ink-dark) !important;max-width: 60rem;margin: 0 auto 2.2rem !important;}.fw-tagline strong { color: var(--fw-royal-gold); font-weight: 600; }.fw-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }.fw-badge {display: inline-block;124 unmodified linesfont-size: 1.35rem !important;}/* ---- scale audio component fonts so they are not diminished ---- */.gradio-container .fw-audio,.gradio-container .fw-audio * {5 unmodified lines.gradio-container .fw-audio button {font-size: 1.35rem !important;}.fw-placeholder-text {color: var(--fw-ink-dark) !important;53 unmodified linesHEADER_HTML = """<div class="fw-hero"><div class="fw-eyebrow">✻ Apache-2.0 • 100% Offline • Trained on Modal </div><h1><span class="fw-accent">fluent</span>Whisper</h1><p class="fw-lede">Speak messy. Read clean.</p><p class="fw-tagline">Cuts fillers, repeats, and false starts in a <strong>single pass.</strong> <br>On your laptop. Offline.</p><p class="fw-lede">9.4% → 3.4% WER</p><p class="fw-tagline">The only open model that does this</p><div class="fw-badges"><span class="fw-badge">whisper-large-v3-turbo</span><span class="fw-badge">Disfluency correction</span><span class="fw-badge">LoRA Finetuned</span><span class="fw-badge gold">Apache-2.0</span></div></div>"""60 unmodified linestype="filepath",label="Speak or upload audio",elem_classes=["fw-audio"],)run_btn = gr.Button("Transcribe", variant="primary", elem_classes=["fw-btn"])with gr.Row():vanilla_out = gr.Textbox(label="Vanilla Whisper", lines=4, elem_classes=["fw-out"])tuned_out = gr.Textbox(label="Cleaned (LoRA)", lines=4, elem_classes=["fw-out"])diff_out = gr.HTML(label="What the LoRA removed",elem_classes=["fw-diff"],value='<span class="fw-placeholder-text">Record or upload some speech to begin.</span>',)run_btn.click(transcribe,48 unmodified lines49505152535455565758596061626 unmodified lines69707172737475767778798081103 unmodified lines18518618718818919019119219319419519619719819920020134 unmodified lines2362372382392402412422432442452462472481 unmodified line2502512522532542552562572582592602612622632642652662672 unmodified lines270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319124 unmodified lines4444454464474484494504514524534544554564574585 unmodified lines46446546646746846947047147247347447547647747847953 unmodified lines53353453553653753853954054154254354454554654754854955055155255355455555655755855956060 unmodified lines62162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165248 unmodified linesdef load_models():"""Load the processor and one base model + LoRA once, on first GPU call.We deliberately load the base weights a *single* time and attach the LoRAon top. Vanilla decoding runs inside a ``disable_adapter()`` context, sothere is only one copy of whisper-large-v3-turbo in memory instead of two.That roughly halves VRAM/RAM and cold-start time, which keeps the page fromlocking up while the first recording is processed."""if _MODELS:return _MODELS6 unmodified linesprocessor = WhisperProcessor.from_pretrained(BASE)base = WhisperForConditionalGeneration.from_pretrained(BASE, torch_dtype=dtype)model = PeftModel.from_pretrained(base, ADAPTER).to(device)model.eval()_MODELS.update(processor=processor,model=model,device=device,dtype=dtype,)103 unmodified lines@spaces.GPU(duration=60)def transcribe(audio_path):if not audio_path:return "", "", '<span class="fw-placeholder-text">Record or upload some speech, then hit Transcribe.</span>'m = load_models()model, processor = m["model"], m["processor"]audio = _load_audio_16k_mono(audio_path)# Vanilla = the same weights with the LoRA switched off, so we never hold a# second copy of the base model in memory.with model.disable_adapter():vanilla_text = _decode(model, processor, audio, m["device"], m["dtype"])tuned_text = _decode(model, processor, audio, m["device"], m["dtype"])return vanilla_text, tuned_text, diff_html(vanilla_text, tuned_text)34 unmodified lines.gradio-container .prose, .gradio-container p, .gradio-container span,.gradio-container label { color: var(--fw-ink-dark); }/* ---- hero — kept compact so the recorder sits within the first screen -- */.fw-hero {background: var(--fw-card);border: 3px double var(--fw-royal-gold);border-radius: 8px;padding: 1.8rem 2.5rem 1.6rem;margin: 0.25rem 0 1.4rem;box-shadow: 0 4px 20px rgba(158,122,68,0.04);text-align: center;}1 unmodified linefont-family: 'Instrument Serif', serif;font-style: normal;text-transform: none;font-size: 1.15rem;font-weight: 600;color: var(--fw-royal-gold);margin: 0 0 0.5rem;}.fw-hero h1 {font-family: 'Instrument Serif', Georgia, serif !important;font-weight: 400 !important;font-size: 3.2rem !important;line-height: 1.04 !important;color: var(--fw-ink-dark) !important;margin: 0 0 0.3rem !important;font-style: normal !important;}.fw-hero h1 .fw-accent {2 unmodified lines}.fw-lede {font-family: 'Instrument Serif', Georgia, serif !important;font-size: 1.55rem !important;color: var(--fw-ink-muted) !important;margin: 0 0 0.6rem !important;}.fw-tagline {font-family: 'Newsreader', Georgia, serif !important;font-size: 1.1rem !important;line-height: 1.55 !important;color: var(--fw-ink-dark) !important;max-width: 42rem;margin: 0 auto 1.1rem !important;}.fw-tagline strong { color: var(--fw-royal-gold); font-weight: 600; }/* ---- WER stat — the visual anchor of the hero ------------------------- */.fw-wer {display: flex;align-items: baseline;justify-content: center;gap: 0.5rem;margin: 0.4rem 0 0.2rem;}.fw-wer-num {font-family: 'Instrument Serif', Georgia, serif;font-size: 3rem;line-height: 1;color: var(--fw-ink-muted);}.fw-wer-good { color: var(--fw-royal-gold); font-weight: 600; }.fw-wer-arrow { font-size: 2rem; color: var(--fw-ink-muted); }.fw-wer-unit {font-family: 'Instrument Serif', Georgia, serif;font-size: 1.6rem;color: var(--fw-ink-dark);letter-spacing: 0.04em;}.fw-wer-note {font-family: 'Newsreader', Georgia, serif !important;font-size: 0.95rem !important;color: var(--fw-ink-muted) !important;margin: 0 auto 1.1rem !important;max-width: 38rem;}.fw-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }.fw-badge {display: inline-block;124 unmodified linesfont-size: 1.35rem !important;}/* ---- call-to-action cue pointing at the recorder ---------------------- */.fw-cta {font-family: 'Instrument Serif', Georgia, serif !important;font-size: 1.25rem !important;font-weight: 600 !important;color: var(--fw-royal-gold) !important;margin: 1.2rem 0 0 !important;}/* ---- scale audio component fonts so they are not diminished ---- */.gradio-container .fw-audio,.gradio-container .fw-audio * {5 unmodified lines.gradio-container .fw-audio button {font-size: 1.35rem !important;}/* Keep the waveform / playback chrome from spilling out of its box (thestray "1x" rate badge overflowing the player). */.gradio-container .fw-audio .waveform-container,.gradio-container .fw-audio .controls,.gradio-container .fw-audio .component-wrapper {max-width: 100% !important;overflow: hidden !important;box-sizing: border-box !important;}.gradio-container .fw-audio .controls * { line-height: normal !important; }.fw-placeholder-text {color: var(--fw-ink-dark) !important;53 unmodified linesHEADER_HTML = """<div class="fw-hero"><div class="fw-eyebrow">✻ Apache-2.0 • Runs offline • Trained on Modal</div><h1><span class="fw-accent">fluent</span>Whisper</h1><p class="fw-lede">Speak messy. Read clean.</p><p class="fw-tagline">Cuts the fillers, repeats, and false starts in a<strong>single local pass</strong> — and shows you exactly what it removed.</p><div class="fw-wer"><span class="fw-wer-num">9.4%</span><span class="fw-wer-arrow">→</span><span class="fw-wer-num fw-wer-good">3.4%</span><span class="fw-wer-unit">WER</span></div><p class="fw-wer-note">vanilla Whisper vs. this adapter on DisfluencySpeech — the only open model that does this</p><div class="fw-badges"><span class="fw-badge">whisper-large-v3-turbo</span><span class="fw-badge">Disfluency correction</span><span class="fw-badge">LoRA finetuned</span><span class="fw-badge gold">Apache-2.0</span></div><p class="fw-cta">Record yourself just below and watch it clean up ↓</p></div>"""60 unmodified linestype="filepath",label="Speak or upload audio",elem_classes=["fw-audio"],show_share_button=False,# The animated live-recording waveform renders continuously on the# browser's main thread and is the prime suspect for the "page# unresponsive" freeze mid-recording. Turn it off; the static# playback waveform still appears once recording stops.waveform_options=gr.WaveformOptions(show_recording_waveform=False),)run_btn = gr.Button("Transcribe", variant="primary", elem_classes=["fw-btn"])# The diff is the headline result, so it sits right under the button —# no scrolling past empty boxes to see what the model did.diff_out = gr.HTML(label="What the LoRA removed",elem_classes=["fw-diff"],value='<span class="fw-placeholder-text">Record or upload some speech, then hit Transcribe.</span>',)with gr.Accordion("Show raw transcripts", open=False):with gr.Row():vanilla_out = gr.Textbox(label="Vanilla Whisper", lines=4, elem_classes=["fw-out"])tuned_out = gr.Textbox(label="Cleaned (LoRA)", lines=4, elem_classes=["fw-out"])run_btn.click(transcribe,
README.md+2-2
__pycache__/app.cpython-314.pyc
app.py+114-49