diff --git a/backend/fastrtc/stream.py b/backend/fastrtc/stream.py index af8792d..52e3227 100644 --- a/backend/fastrtc/stream.py +++ b/backend/fastrtc/stream.py @@ -346,7 +346,7 @@ class Stream(WebRTCConnectionMixin): gr.HTML( f"""

- {ui_args.get("title", "Audio Streaming (Powered by WebRTC ⚡️)")} + {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")}

""" ) @@ -385,7 +385,7 @@ class Stream(WebRTCConnectionMixin): gr.HTML( f"""

- {ui_args.get("title", "Audio Streaming (Powered by WebRTC ⚡️)")} + {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")}

""" ) @@ -428,7 +428,7 @@ class Stream(WebRTCConnectionMixin): gr.HTML( f"""

- {ui_args.get("title", "Audio Streaming (Powered by WebRTC ⚡️)")} + {ui_args.get("title", "Audio Video Streaming (Powered by FastRTC ⚡️)")}

""" ) @@ -563,6 +563,7 @@ class Stream(WebRTCConnectionMixin): from gradio.networking import setup_tunnel from gradio.tunneling import CURRENT_TUNNELS from huggingface_hub import get_token + import atexit app = FastAPI() @@ -618,6 +619,16 @@ class Stream(WebRTCConnectionMixin): ) + " for information on making your handler compatible with phone usage." ) + + def unregister(): + httpx.post( + URL + "/unregister", + json={"url": host, "code": code}, + headers={"Authorization": token or get_token() or ""}, + ) + + atexit.register(unregister) + try: while True: time.sleep(0.1) @@ -626,11 +637,7 @@ class Stream(WebRTCConnectionMixin): click.style("INFO", fg="green") + ":\t Keyboard interruption in main thread... closing server." ) - r = httpx.post( - URL + "/unregister", - json={"url": host, "code": code}, - headers={"Authorization": token or get_token() or ""}, - ) + unregister() t.join(timeout=5) for tunnel in CURRENT_TUNNELS: tunnel.kill() diff --git a/docs/index.md b/docs/index.md index 9064987..a365816 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ The Real-Time Communication Library for Python. Turn any python function into a real-time audio and video stream over WebRTC or WebSockets. - + ## Installation @@ -25,10 +25,10 @@ Turn any python function into a real-time audio and video stream over WebRTC or pip install fastrtc ``` -to use built-in pause detection (see [ReplyOnPause](userguide/audio/#reply-on-pause)), and text to speech (see [Text To Speech](userguide/audio/#text-to-speech)), install the `vad` and `tts` extras: +to use built-in pause detection (see [ReplyOnPause](userguide/audio/#reply-on-pause)), speech-to-text (see [Speech To Text](userguide/audio/#speech-to-text)), and text to speech (see [Text To Speech](userguide/audio/#text-to-speech)), install the `vad`, `stt`, and `tts` extras: ```bash -pip install fastrtc[vad, tts] +pip install fastrtc[vad, stt, tts] ``` ## Quickstart diff --git a/frontend/shared/InteractiveAudio.svelte b/frontend/shared/InteractiveAudio.svelte index 58d8ab5..2a4f011 100644 --- a/frontend/shared/InteractiveAudio.svelte +++ b/frontend/shared/InteractiveAudio.svelte @@ -304,7 +304,11 @@ {:else if stream_state === "open"}
-
+
stream} stream_state={"open"}