mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 18:09:23 +08:00
add code (#189)
This commit is contained in:
@@ -81,13 +81,17 @@ class Stream(WebRTCConnectionMixin):
|
|||||||
self._ui = self._generate_default_ui(ui_args)
|
self._ui = self._generate_default_ui(ui_args)
|
||||||
self._ui.launch = self._wrap_gradio_launch(self._ui.launch)
|
self._ui.launch = self._wrap_gradio_launch(self._ui.launch)
|
||||||
|
|
||||||
def mount(self, app: FastAPI):
|
def mount(self, app: FastAPI, path: str = ""):
|
||||||
app.router.post("/webrtc/offer")(self.offer)
|
from fastapi import APIRouter
|
||||||
app.router.websocket("/telephone/handler")(self.telephone_handler)
|
|
||||||
app.router.post("/telephone/incoming")(self.handle_incoming_call)
|
router = APIRouter(prefix=path)
|
||||||
app.router.websocket("/websocket/offer")(self.websocket_offer)
|
router.post("/webrtc/offer")(self.offer)
|
||||||
|
router.websocket("/telephone/handler")(self.telephone_handler)
|
||||||
|
router.post("/telephone/incoming")(self.handle_incoming_call)
|
||||||
|
router.websocket("/websocket/offer")(self.websocket_offer)
|
||||||
lifespan = self._inject_startup_message(app.router.lifespan_context)
|
lifespan = self._inject_startup_message(app.router.lifespan_context)
|
||||||
app.router.lifespan_context = lifespan
|
app.router.lifespan_context = lifespan
|
||||||
|
app.include_router(router)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print_error(env: Literal["colab", "spaces"]):
|
def print_error(env: Literal["colab", "spaces"]):
|
||||||
|
|||||||
Reference in New Issue
Block a user