This commit is contained in:
Freddy Boulton
2025-03-06 19:56:46 -05:00
committed by GitHub
parent 7dfee78261
commit 11dae295da
2 changed files with 60 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ from .credentials import (
from .reply_on_pause import AlgoOptions, ReplyOnPause, SileroVadOptions from .reply_on_pause import AlgoOptions, ReplyOnPause, SileroVadOptions
from .reply_on_stopwords import ReplyOnStopWords from .reply_on_stopwords import ReplyOnStopWords
from .speech_to_text import MoonshineSTT, get_stt_model from .speech_to_text import MoonshineSTT, get_stt_model
from .stream import Stream from .stream import Stream, UIArgs
from .text_to_speech import KokoroTTSOptions, get_tts_model from .text_to_speech import KokoroTTSOptions, get_tts_model
from .tracks import ( from .tracks import (
AsyncAudioVideoStreamHandler, AsyncAudioVideoStreamHandler,
@@ -62,4 +62,5 @@ __all__ = [
"get_tts_model", "get_tts_model",
"KokoroTTSOptions", "KokoroTTSOptions",
"wait_for_item", "wait_for_item",
"UIArgs",
] ]

View File

@@ -36,6 +36,8 @@ class Body(BaseModel):
class UIArgs(TypedDict): class UIArgs(TypedDict):
title: NotRequired[str] title: NotRequired[str]
"""Title of the demo""" """Title of the demo"""
subtitle: NotRequired[str]
"""Subtitle of the demo. Text will be centered and displayed below the title."""
icon: NotRequired[str] icon: NotRequired[str]
"""Icon to display on the button instead of the wave animation. The icon should be a path/url to a .svg/.png/.jpeg file.""" """Icon to display on the button instead of the wave animation. The icon should be a path/url to a .svg/.png/.jpeg file."""
icon_button_color: NotRequired[str] icon_button_color: NotRequired[str]
@@ -190,6 +192,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():
@@ -229,6 +239,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():
@@ -269,6 +287,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Column(elem_classes=["my-column"]): with gr.Column(elem_classes=["my-column"]):
@@ -308,6 +334,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():
@@ -352,6 +386,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():
@@ -395,6 +437,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():
@@ -439,6 +489,14 @@ class Stream(WebRTCConnectionMixin):
<h1 style='text-align: center'> <h1 style='text-align: center'>
{ui_args.get("title", "Audio Video Streaming (Powered by FastRTC ⚡️)")} {ui_args.get("title", "Audio Video Streaming (Powered by FastRTC ⚡️)")}
</h1> </h1>
"""
)
if ui_args.get("subtitle"):
gr.Markdown(
f"""
<div style='text-align: center'>
{ui_args.get("subtitle")}
</div>
""" """
) )
with gr.Row(): with gr.Row():