Skip to content

Fix streaming issues#1828

Merged
abidlabs merged 2 commits into
mainfrom
stream_fix
Jul 19, 2022
Merged

Fix streaming issues#1828
abidlabs merged 2 commits into
mainfrom
stream_fix

Conversation

@aliabid94
Copy link
Copy Markdown
Contributor

@aliabid94 aliabid94 commented Jul 19, 2022

Hide status loading animation on stream, fix echo in stream on last audio chunk.

Check demo/stream_audio for example.

Still not 100% if audio streaming is being done the correct way (basically stopping and starting the MediaRecorder at 500ms intervals) but seems to work.

@aliabid94 aliabid94 requested review from abidlabs and pngwn July 19, 2022 15:26
@abidlabs
Copy link
Copy Markdown
Member

abidlabs commented Jul 19, 2022

Just to confirm, does this close #1323, #1332, and #1494?

@freddyaboulton
Copy link
Copy Markdown
Collaborator

freddyaboulton commented Jul 19, 2022

Thanks @aliabid94 !

Confirmed this fixes the audio/image streaming example. The only thing is that I noticed a very faint flicker in the audio component during flicker (you can kind of see it at second 7 in this gif) but I think that's ok

stream_audio

Not sure about #1323

@abidlabs
Copy link
Copy Markdown
Member

Yup also tested this with the examples from our real time ASR guide:

from transformers import pipeline
import gradio as gr
import time

p = pipeline("automatic-speech-recognition")

def transcribe(audio, state=""):
    time.sleep(2)
    text = p(audio)["text"]
    state += text + " "
    return state, state

gr.Interface(
    fn=transcribe, 
    inputs=[
        gr.Audio(source="microphone", type="filepath", streaming=True), 
        "state"
    ],
    outputs=[
        "textbox",
        "state"
    ],
    live=True).launch()

and the examples work great! I think we can fix the flicker & clean up any other issues we fine in a future PR, but for the sake of releasing 3.1, let's go ahead and merge this in.

@abidlabs abidlabs closed this Jul 19, 2022
@abidlabs abidlabs reopened this Jul 19, 2022
@abidlabs abidlabs merged commit 597d22e into main Jul 19, 2022
@abidlabs abidlabs deleted the stream_fix branch July 19, 2022 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants