mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
Pass Websocket to the context if available (#329)
* Add code * Code * Fix * Add code
This commit is contained in:
@@ -16,6 +16,7 @@ from typing import Any, Literal, Protocol, TypedDict, cast
|
||||
import av
|
||||
import librosa
|
||||
import numpy as np
|
||||
from fastapi import WebSocket
|
||||
from numpy.typing import NDArray
|
||||
from pydub import AudioSegment
|
||||
|
||||
@@ -67,6 +68,7 @@ current_channel: ContextVar[DataChannel | None] = ContextVar(
|
||||
@dataclass
|
||||
class Context:
|
||||
webrtc_id: str
|
||||
websocket: WebSocket | None = None
|
||||
|
||||
|
||||
current_context: ContextVar[Context | None] = ContextVar(
|
||||
|
||||
Reference in New Issue
Block a user