Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Nachimak28/LAI-voice-search-openai-whisper-demo

A ⚡️ Lightning.ai ⚡️ app demo for Voice based web search using OpenAI's Whisper and DuckDuckGo
https://github.com/Nachimak28/LAI-voice-search-openai-whisper-demo

openai speech-to-text websearch whisper

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# Speech Search Engine with Whisper

[![LAI](https://bit.ly/3xTcccO)][#app-gallery]

[#app-gallery]: https://01gfax73s2tn315zme310fkh4z.litng-ai-03.litng.ai/view/home

This app is a simulation of a Voice search feature provided by search engines like Google, DuckDuckGo using OpenAI's [Whisper](https://openai.com/blog/whisper/) model.

This ⚡ [Lightning app](lightning.ai) ⚡ was generated automatically with:

```bash
lightning init app LAI_voice_search_openai_whisper_demo
```

## Sample output
![Sample output](https://github.com/Nachimak28/LAI-voice-search-openai-whisper-demo/blob/master/assets/demo_output.PNG)

## 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
```bash
conda create --yes --name oaiwhisper python=3.8
conda activate oaiwhisper
```

* Install FFMPEG

FFMPEG is necessary for the audio processing

- For Windows: Follow [these steps](https://www.wikihow.com/Install-FFmpeg-on-Windows)
- For Ubuntu/Debian:
```bash
sudo apt-get update
sudo apt-get install -y ffmpeg
```
* Install packages

```bash
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):

```bash
lightning install app https://github.com/theUser/LAI_voice_search_openai_whisper_demo
```

* Run locally

Once the app is installed, run it locally with:

```bash
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](lightning.ai) with:

```bash
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)

```bash
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](https://github.com/deedy5/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
- [x] Update code to accept microphone input as soon as Gradio bug is resolved
- [x] Write unit tests
- [x] Run given test
- [x] Add comments and prepare code for submission to Lightning Gallery