Nachimak28 / LAI-voice-search-openai-whisper-demo

A ⚡️ Lightning.ai ⚡️ app demo for Voice based web search using OpenAI's Whisper and DuckDuckGo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Speech Search Engine with Whisper

LAI

This app is a simulation of a Voice search feature provided by search engines like Google, DuckDuckGo using OpenAI's Whisper model.

This ⚡ Lightning app ⚡ was generated automatically with:

lightning init app LAI_voice_search_openai_whisper_demo

Sample output

Sample output

To run LAI_voice_search_openai_whisper_demo

Prerequisites

  • Create a conda/venv environment

We use conda here but you can use whichever tool you're comfortable with

conda create --yes --name oaiwhisper python=3.8
conda activate oaiwhisper
  • Install FFMPEG

FFMPEG is necessary for the audio processing

sudo apt-get update
sudo apt-get install -y ffmpeg
  • Install packages
pip install -r requirements.txt
  • Install app

First, install LAI_voice_search_openai_whisper_demo (warning: this app has not been officially approved on the lightning gallery):

lightning install app https://github.com/theUser/LAI_voice_search_openai_whisper_demo
  • Run locally

Once the app is installed, run it locally with:

lightning run app LAI_voice_search_openai_whisper_demo/app.py

If the above does not work, manually setup the environment:

git clone https://github.com/Nachimak28/LAI-voice-search-openai-whisper-demo
cd LAI-voice-search-openai-whisper-demo
conda create --yes --name oaiwhisper python=3.8
conda activate oaiwhisper
python -m pip install -r requirements.txt
python -m pip install lightning
python -m lightning run app app.py

# to run on lightning cloud
python -m lightning run app app.py --cloud

Run it on the lightning cloud with:

lightning run app LAI_voice_search_openai_whisper_demo/app.py --cloud

to test and link

Run flake to make sure all your styling is consistent (it keeps your team from going insane)

flake8 .

To test, follow the README.md instructions in the tests folder.

Steps followed to build such a feature in this minimal app

  • Obtain the Speech-to-text (transcription) output using Whisper
  • Use this transcribed output string as an input for duckduckgo search
  • Once the web search results are obtained, render using HTML

FAQ

  • Why use DuckDuckGo(DDG) and not Google search? Ans: Google has a lot of rate limiting applied and frequent searches via code lead to getting blocked resulting in status code: 429 - Too many requests. Apparently DDG does not have super strict rate limiting.

  • Why Lightning.ai ? Ans: Provisioning the infra and deployment is automated, all one needs to do is focus on business logic. Also HF spaces are too crowded with mutiple such demos.

TODOs

  • Update code to accept microphone input as soon as Gradio bug is resolved
  • Write unit tests
  • Run given test
  • Add comments and prepare code for submission to Lightning Gallery

About

A ⚡️ Lightning.ai ⚡️ app demo for Voice based web search using OpenAI's Whisper and DuckDuckGo

License:Apache License 2.0


Languages

Language:Python 100.0%