# Gradio with Whisper

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgradio-with-whisper%2F34522%3E%5C
**Category:** 🔒 Gradio\
**Created:** [March 23, 2023, 11:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgradio-with-whisper%2F34522 "2023-03-23T23:19:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bharadwaj509](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@bharadwaj509](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbharadwaj509)%5C
**Post date:** [March 23, 2023, 11:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgradio-with-whisper%2F34522%2F1 "2023-03-23T23:19:43Z")

</div>

Can we do soemthing like this with Gradio and Parallel. I tried both microphone and browse button for mp3 files, but both are resulting in the below error.

```auto
import gradio as gr

generator1 = gr.Interface.load("models/openai/whisper-base")
generator2 = gr.Interface.load("models/openai/whisper-base")
generator3 = gr.Interface.load("models/openai/whisper-base")

demo = gr.Parallel(generator1, generator2, generator3)

demo.launch()

```

Error:

```auto
/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/processing_utils.py:239: UserWarning: Trying to convert audio automatically from int32 to 16-bit int format.
  warnings.warn(warning.format(data.dtype))
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/routes.py", line 393, in run_predict
    output = await app.get_blocks().process_api(
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/blocks.py", line 1069, in process_api
    result = await self.call_function(
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/blocks.py", line 876, in call_function
    prediction = await fn(*processed_input)
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/mix.py", line 42, in parallel_fn
    return_values_with_durations = await asyncio.gather(
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/blocks.py", line 878, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/anyio/to_thread.py", line 28, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
    return await future
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 754, in run
    result = context.run(func, *args)
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/external.py", line 317, in query_huggingface_api
    data = pipeline["preprocess"](*params)
  File "/usr/local/anaconda3/envs/aimlstuff/lib/python3.10/site-packages/gradio/processing_utils.py", line 46, in to_binary
    return base64.b64decode(base64str.split(",")[1])
IndexError: list index out of range

```

Is there more documentation on this? Can any one help me?

---

<div class="post-metadata">

**Author:** ![bharadwaj509](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@bharadwaj509](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbharadwaj509)%5C
**Post date:** [March 24, 2023, 2:36am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgradio-with-whisper%2F34522%2F2 "2023-03-24T02:36:57Z")

</div>

So, I need to convert the data that I am giving in to an audio file. I was using the following code without Parallel.

```auto
audio = whisper.load_audio(audio)
audio = whisper.pad_or_trim(audio)

```

I tried loading the method as an interface too but that throws me an error related to Tensors.  
Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![AtxTom](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@AtxTom](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAtxTom)%5C
**Post date:** [April 28, 2023, 5:51pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgradio-with-whisper%2F34522%2F3 "2023-04-28T17:51:07Z")

</div>

Hey, what are you trying to do?  
I run this code locally that will transcribe a video or audio file for demonstrations on using whisper.

```auto
import whisper
import gradio as gr

model = whisper.load_model("medium.en") # you can use base instead
def audio_to_text(file):
    result = model.transcribe(file, fp16=False, verbose=True)
    text = result["text"]
    return text

demo = gr.Interface(
    fn=audio_to_text, 
    inputs=gr.Video(),
    outputs="text")
demo.launch(show_error=True)

```
