mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-21 01:01:05 +08:00
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:
parent
b1c5a68f90
commit
8f6626cd0e
5
.changeset/silly-hairs-burn.md
Normal file
5
.changeset/silly-hairs-burn.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:Fix streaming Audio/Video Output
|
@ -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
|
||||
|
||||
|
||||
|
@ -466,7 +466,7 @@ class ChatInterface(Blocks):
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
cancels=events_to_cancel,
|
||||
cancels=events_to_cancel, # type: ignore
|
||||
show_api=False,
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user