Giter Site home page Giter Site logo

rudolfvonkrugstein / faster-whisper-life-transcribing Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 62 KB

An attempt to builda FastAPI based websocket server, to transcribe speech as fast as possible using faster-whisper

License: MIT License

Python 46.86% HTML 3.00% JavaScript 50.14%

faster-whisper-life-transcribing's Introduction

faster-whisper-life-transcribing

An attempt to builds FastAPI based web socket server, to transcribe speech as fast as possible using faster-whisper

faster whisper is a whisper implementation allowing speech to text recognition using the OpenAI whisper model. For details check out their GitHub page.

NOTE: This is more of an personal experiment than a product or anything I would advice to use in production. But if you are interested, feel free to contribute, ask questions and try it out if it helps you in your use case.

This is an attempt to provide a FastAPI + web socket implementation for life speech transcription, similar to what you get from the google speech recognition service.

What?

The Idea is to receive streaming (life) audio data from the client and continuously run faster-whisper on it to send back the intermediate result to the client.

Whenever the beginning of the result can be considered stable enough (and how to judge that is the tricky part) so it won't change on receiving further audio, the transcription is saved and the audio removed so that it wont be run again through whisper.

Why?

For one, it gives you (or your user) an "early" preview (earlier, than if you would run it afterwards) of what they are saying.

Secondly, it can reduce the time between the user speaking and the transcription result being finished because part of the transcription may have been done earlier and does not have to be recognized again. But that is only the case of the speech is long enough.

How?

  1. The a client opens a web socket connection and streams audio to the server.
  2. The server (the application in this repo) buffers the data and opens a worker thread and continuously runs "faster whisper" in the so far received data.
  3. When the thread finishes a transcription, it can decide that the beginning of the transcription will not change anymore even with more audio data. It then removes the audio data and stores the intermediate result.
@startuml

partition Client #0FC00F {

  "Read Microfone" --> "Send Audio Data"
  --> "Read Microfone"

}

partition Server #CCCCEE {
  "Buffer incoming audio data" -[dotted]r-> "Read new Audio Data"

  "Read new Audio Data" --> "Run transcription"
  "Run transcription" --> "Update finished text"
  --> "Send intermediate Result to client"
  --> "Read new Audio Data"

}

Client -[hidden]-> Server

"Send Audio Data" -[dotted]-> "Buffer incoming audio data"
"Send intermediate Result to client" -[dotted]l-> Client

@enduml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.