Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise WasmUnsupportedError for ffmpeg usage on Lite #9130

Merged
merged 9 commits into from
Aug 20, 2024
6 changes: 5 additions & 1 deletion gradio/components/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from gradio_client.documentation import document
from pydub import AudioSegment

from gradio import processing_utils, utils
from gradio import processing_utils, utils, wasm_utils
from gradio.components.base import Component, StreamingInput, StreamingOutput
from gradio.data_classes import FileData, FileDataDict, MediaStreamChunk
from gradio.events import Events
Expand Down Expand Up @@ -310,6 +310,10 @@ def postprocess(

@staticmethod
def _convert_to_adts(data: bytes):
if wasm_utils.IS_WASM:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also raise if needs_conversion is True in preprocess. I am pretty sure that pydub is using ffmpeg under the hood in that case.

raise wasm_utils.WasmUnsupportedError(
"Audio streaming is not supported in the Wasm mode."
)
segment = AudioSegment.from_file(io.BytesIO(data))

buffer = io.BytesIO()
Expand Down
Loading