# gr.Interface.from\_pipeline() vs gr.Interface()

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%3E%5C
**Category:** 🔒 Gradio\
**Created:** [March 23, 2022, 12:08am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977 "2022-03-23T00:08:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![epdavid2](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@epdavid2](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fepdavid2)%5C
**Post date:** [March 23, 2022, 12:08am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%2F1 "2022-03-23T00:08:46Z")

</div>

Hello!

I wrote this simple ASR using pipeline and it works flawlessly

```auto
pip install gradio
pip install pipeline
pip install transformers

import gradio as gr
from transformers import pipeline

pipe = pipeline("automatic-speech-recognition", "facebook/wav2vec2-base-960h")
gr.Interface.from_pipeline(pipe).launch()

```

But because of the pipeline, I am limited to what I can do with the output (if my assumption in using pipelines is correct). So I tried using gr.Interface() so I can put stuff inside my function

```auto
def asr(mic_input): #edited now
  if "hello" in str(pipe(mic_input)): #convert to string so I can search inside
    reply = "hi"
    return reply
  else:
    return str(pipe(mic_input))

gr.Interface(fn=asr,
             inputs="mic",
             outputs="text",
             ).launch()

```

What I am expecting is if it detects a “hello” somewhere in the speech, it replies “hi” instead of transcribing the speech audio. However, after submitting the recorded audio from the mic, it only displays “error”

 ![gradio](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/e2878fd9d90a2349ec5bcf8bfda0d8d4e2b68e29.jpeg)

I did similar concepts of manipulating the output with other tasks such as text classification and it worked flawlessly. My guess is that there’s something happening within the pipeline that is particular in processing audio files input? If so, how can I manually do what the pipeline does?

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [March 23, 2022, 9:06am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%2F2 "2022-03-23T09:06:38Z")

</div>

Hey there @epdavid2, as a tip, you can add `debug=True` in `launch` and you will get more information on the error

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [March 23, 2022, 9:10am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%2F3 "2022-03-23T09:10:19Z")

</div>

So the error is in the `asr` method. The parameter has a type, it is `mic_nput` but in the function you use `mic_input`

---

<div class="post-metadata">

**Author:** ![epdavid2](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@epdavid2](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fepdavid2)%5C
**Post date:** [March 23, 2022, 9:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%2F4 "2022-03-23T09:22:19Z")

</div>

@osanseviero Hello! I actually corrected the mic\_nput a while ago but the error still persists. I’m looking at the debug notes right now. Thank you!

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [March 23, 2022, 9:43am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgr-interface-from-pipeline-vs-gr-interface%2F15977%2F5 "2022-03-23T09:43:13Z")

</div>

SG! As a tip, you can check what the audio actually gives you [Gradio Docs](https://gradio.app/docs/#i_audio) (it is tuple of sample rate and the numpy array, you just want the second element).
