Fix streaming Audio/Video Output (#9656)

* Fix

* add changeset

* lint

* add changeset

* type ignore

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Freddy Boulton 2024-10-11 13:19:09 -07:00 committed by GitHub
parent b1c5a68f90
commit 8f6626cd0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 10 additions and 7 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
feat:Fix streaming Audio/Video Output

View File

@ -391,9 +391,7 @@ class Block:
return client_utils.synchronize_async(
processing_utils.async_move_files_to_cache, data, self
)
except (
AttributeError
): # Can be raised if this function is called before the Block is fully initialized.
except AttributeError: # Can be raised if this function is called before the Block is fully initialized.
return data

View File

@ -466,7 +466,7 @@ class ChatInterface(Blocks):
None,
None,
None,
cancels=events_to_cancel,
cancels=events_to_cancel, # type: ignore
show_api=False,
)

View File

@ -339,6 +339,7 @@ class Audio(
"path": output_id,
"is_stream": True,
"orig_name": "audio-stream.mp3",
"meta": {"_type": "gradio.FileData"},
}
if value is None:
return None, output_file

View File

@ -559,6 +559,7 @@ class Video(StreamingOutput, Component):
# Need to set orig_name so that downloaded file has correct
# extension
"orig_name": "video-stream.mp4",
"meta": {"_type": "gradio.FileData"},
}
}
if value is None:

View File

@ -461,9 +461,7 @@ class App(FastAPI):
not callable(app.auth)
and username in app.auth
and compare_passwords_securely(password, app.auth[username]) # type: ignore
) or (
callable(app.auth) and app.auth.__call__(username, password)
): # type: ignore
) or (callable(app.auth) and app.auth.__call__(username, password)): # type: ignore
token = secrets.token_urlsafe(16)
app.tokens[token] = username
response = JSONResponse(content={"success": True})