Git Product home page Git Product logo

aoai-whisper-gradio's Introduction

Demo Whisper / GPT / DallE in the Gradio-powered Web apps

Whisper models allow you to transcribe and translate audio files, using their speech-to-text capabilities.

If you want to know more about the possibilities for Whisper visit this link To discover the languages supported visit this link - Actually the last version is V3 ( in open AI is still in V2 apis call )

There are difference between use Whisper by azure Ai speech or use whisper by Azure open Ai service for different feature visit this link to know the possilities

Extract from the documentation Difference between whisper

Dall-E model allow you to transform text to image or prompt to image, so in simple terms it draws pictures based on your description

We will display how to utilise Whisper models offline or consume them through an Azure endpoint (either from Azure OpenAI or Azure AI Speech resources).

You can access have the access to the portal Azure AI speech on this link

The Table of contents below is wrapped into a functional Web interface, powered by Gradio

Table of contents:

Option 0 - Access to Whisper models in offline mode / local

Whisper model can be consumed offline. You may notice differences in its performance on the weaker local computers in comparison to an Azure based deployment. At the same time, this may serve certain scenarios where access to external resources is prohibited or not possible.

To instantiate Web app with offline Whisper functionality, please follow these steps:

  1. Install gradio Python package. This will allow you to define and instantiate a Web app, that will run locally as a Web service.
pip install --upgrade gradio
  1. Install openai-whisper Python package. It comes with a few pre-trained Whisper models of various sizes. E.g. "base" model may require ~1 Gb of RAM, while "large" one would expect ~10 Gb of RAM. Whipser model

if you want to select other Whisper model inside the notebook you will have to change this line with the correct name

whisper.load_model("base")

pip install --upgrade openai-whisper

Note: You may also require installation of FFMpeg package to make this solution work on your local computer.

pip install ffpmpeg
  1. Launch provided Python script for offline Web app.
python 0_Whisper_Offline.py

If successful, you should be able to access new Web app's interface at http://127.0.0.1:7860/ as shown below. You can now record your speech through the computer's microphone and transcribe it using one of selected Whisper models. screenshot_0_offline

Option 1 - Access to Whisper models via Azure OpenAI endpoint

Whisper models are now available as a part of Azure OpenAI resource. To consume its API endpoint in your Gradio app, please follow these steps:

  1. Create a deployment and Deploy Whisper in available Azure OpenAI region in *The Azure openAi studio

  2. Go to the azure portal to select the deployment. screenshot_1_deploy

  3. Copy API endpoint and key details. screenshot_1_access

  4. Install gradio Python package. This will allow you to define and instantiate a Web app, that will run locally as a Web service.

pip install --upgrade gradio
  1. Install openai Python package. This is the client SDK that your Web app will use to interact with Azure OpenAI endpoint or Open Ai model if you need it
pip install --upgrade openai
  1. Launch provided Python script for a Web app, integrated with Azure OpenAI endpoint.
python 1_Whisper_AOAI_endpoint.py

If successful, you should be able to access new Web app's interface at http://127.0.0.1:7860/ as shown below. You can now record your speech through the computer's microphone and transcribe it using Whisper model enabled in Azure OpenAI. screenshot_1_AOAI

Option 2 - Access to Whisper models via Azure AI Speech endpoint - URI access

๐Ÿšง :octocat: don't work now :octocat:

๐Ÿšง
Whisper models are also available through Azure AI Speech. Using batch API (similar to what is described here), can increase audio file size limit up to 1 Gb.

pip install --upgrade azure-cognitiveservices-speech

You could find some information for using whisper models in Azure speech inside this page

This demo is based on this link

Option 3 - Whisper model / processing GPT and Dall-E generation

This last demo is the more advanced with diffrent tabs and possiblity to customize your choice in the bottom in the page

Custom params for demo

In your terminal in visual studio code or powershell / cmd

python 3_Whisper_process_dalle.py

You will have the information in terminal cmd

Running on local URL:  http://127.0.0.1:7860

You could open your webbrowser at the localhost adress shown http://127.0.0.1:7860

alt text

aoai-whisper-gradio's People

Contributors

lazauk avatar olivmertens avatar

Stargazers

 avatar  avatar

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.