VikasSharma707 / chatgpt-api-whisper-api-voice-assistant

1 stars 0 forks source link

Whisper web app instead of whisper API #3

Open Thanatosq opened 1 year ago

Thanatosq commented 1 year ago

How to use whisper web app ( https://github.com/petewarden/openai-whisper-webapp) instead of whisper API.

VikasSharma707 commented 1 year ago

What's your issue??

Thanatosq commented 1 year ago

What's your issue??

In the chatbot, you are using openai whisper API for Transcribing the audio. But I want to use the openai whisper web app (which doesn't need an API) for the transcription.

Can you tell me how do that Also I am using Colab.

VikasSharma707 commented 1 year ago

your above link used tiktoken for api. you can use whatever you like!

go to this link for more: https://github.com/openai/tiktoken

Thanatosq commented 1 year ago

I tried to integrate the openai whisper web app into my chatbot for speech to text in Colab.

But it is not working correctly. When I give the microphone input, the chatbot gives a response something like " I hear a person counting from 1-100" or "I give this audio clip a 9 out of 10". The chatbot doesn't give anything else than this response.

Can you take a look.

CODE

import gradio as gr
import openai

openai.api_key = 'Api_Key'

def ask_gpt(prompt, model):
    response = openai.Completion.create(
        engine=model,
        prompt=prompt,
        max_tokens=1024,
        n=1,
        stop=None,
        temperature=0.7
    )

    return response.choices[0].text.strip()

def conversation_transcribe(prompt):
    model = 'text-davinci-003'
    response = ask_gpt(prompt=f'User: {prompt}\\nBot: ', model=model)
    return response

def main():
    gr.Interface(
        title='OpenAI Whisper ASR Gradio Web UI',
        fn=conversation_transcribe,
        inputs=[
            gr.inputs.Audio(source="microphone", type="filepath")
        ],
        outputs=[
            "text"
        ],
        live=True
    ).launch()

if __name__ == '__main__':
    main()
Thanatosq commented 1 year ago

Any updates on this?