@@ -59,6 +59,8 @@ class UIArgs(TypedDict):
59
59
If "submit", the input will be sent when the submit event is triggered by the user.
60
60
If "change", the input will be sent whenever the user changes the input value.
61
61
"""
62
+ hide_title : NotRequired [bool ]
63
+ """If True, the title and subtitle will not be displayed."""
62
64
63
65
64
66
class Stream (WebRTCConnectionMixin ):
@@ -339,21 +341,22 @@ def _generate_default_ui(
339
341
same_components .append (component )
340
342
if self .modality == "video" and self .mode == "receive" :
341
343
with gr .Blocks () as demo :
342
- gr .HTML (
343
- f"""
344
- <h1 style='text-align: center'>
345
- { ui_args .get ("title" , "Video Streaming (Powered by FastRTC ⚡️)" )}
346
- </h1>
347
- """
348
- )
349
- if ui_args .get ("subtitle" ):
350
- gr .Markdown (
344
+ if not ui_args .get ("hide_title" ):
345
+ gr .HTML (
351
346
f"""
352
- <div style='text-align: center'>
353
- { ui_args .get ("subtitle " )}
354
- </div >
355
- """
347
+ <h1 style='text-align: center'>
348
+ { ui_args .get ("title" , "Video Streaming (Powered by FastRTC ⚡️) " )}
349
+ </h1 >
350
+ """
356
351
)
352
+ if ui_args .get ("subtitle" ):
353
+ gr .Markdown (
354
+ f"""
355
+ <div style='text-align: center'>
356
+ { ui_args .get ("subtitle" )}
357
+ </div>
358
+ """
359
+ )
357
360
with gr .Row ():
358
361
with gr .Column ():
359
362
if additional_input_components :
@@ -391,21 +394,22 @@ def _generate_default_ui(
391
394
)
392
395
elif self .modality == "video" and self .mode == "send" :
393
396
with gr .Blocks () as demo :
394
- gr .HTML (
395
- f"""
396
- <h1 style='text-align: center'>
397
- { ui_args .get ("title" , "Video Streaming (Powered by FastRTC ⚡️)" )}
398
- </h1>
399
- """
400
- )
401
- if ui_args .get ("subtitle" ):
402
- gr .Markdown (
397
+ if not ui_args .get ("hide_title" ):
398
+ gr .HTML (
403
399
f"""
404
- <div style='text-align: center'>
405
- { ui_args .get ("subtitle " )}
406
- </div >
407
- """
400
+ <h1 style='text-align: center'>
401
+ { ui_args .get ("title" , "Video Streaming (Powered by FastRTC ⚡️) " )}
402
+ </h1 >
403
+ """
408
404
)
405
+ if ui_args .get ("subtitle" ):
406
+ gr .Markdown (
407
+ f"""
408
+ <div style='text-align: center'>
409
+ { ui_args .get ("subtitle" )}
410
+ </div>
411
+ """
412
+ )
409
413
with gr .Row ():
410
414
if additional_input_components :
411
415
with gr .Column ():
@@ -494,21 +498,22 @@ def _generate_default_ui(
494
498
)
495
499
elif self .modality == "audio" and self .mode == "receive" :
496
500
with gr .Blocks () as demo :
497
- gr .HTML (
498
- f"""
499
- <h1 style='text-align: center'>
500
- { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️)" )}
501
- </h1>
502
- """
503
- )
504
- if ui_args .get ("subtitle" ):
505
- gr .Markdown (
501
+ if not ui_args .get ("hide_title" ):
502
+ gr .HTML (
506
503
f"""
507
- <div style='text-align: center'>
508
- { ui_args .get ("subtitle " )}
509
- </div >
510
- """
504
+ <h1 style='text-align: center'>
505
+ { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️) " )}
506
+ </h1 >
507
+ """
511
508
)
509
+ if ui_args .get ("subtitle" ):
510
+ gr .Markdown (
511
+ f"""
512
+ <div style='text-align: center'>
513
+ { ui_args .get ("subtitle" )}
514
+ </div>
515
+ """
516
+ )
512
517
with gr .Row ():
513
518
with gr .Column ():
514
519
for component in additional_input_components :
@@ -549,21 +554,22 @@ def _generate_default_ui(
549
554
)
550
555
elif self .modality == "audio" and self .mode == "send" :
551
556
with gr .Blocks () as demo :
552
- gr .HTML (
553
- f"""
554
- <h1 style='text-align: center'>
555
- { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️)" )}
556
- </h1>
557
- """
558
- )
559
- if ui_args .get ("subtitle" ):
560
- gr .Markdown (
557
+ if not ui_args .get ("hide_title" ):
558
+ gr .HTML (
561
559
f"""
562
- <div style='text-align: center'>
563
- { ui_args .get ("subtitle " )}
564
- </div >
565
- """
560
+ <h1 style='text-align: center'>
561
+ { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️) " )}
562
+ </h1 >
563
+ """
566
564
)
565
+ if ui_args .get ("subtitle" ):
566
+ gr .Markdown (
567
+ f"""
568
+ <div style='text-align: center'>
569
+ { ui_args .get ("subtitle" )}
570
+ </div>
571
+ """
572
+ )
567
573
with gr .Row ():
568
574
with gr .Column ():
569
575
with gr .Group ():
@@ -604,21 +610,22 @@ def _generate_default_ui(
604
610
)
605
611
elif self .modality == "audio" and self .mode == "send-receive" :
606
612
with gr .Blocks () as demo :
607
- gr .HTML (
608
- f"""
609
- <h1 style='text-align: center'>
610
- { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️)" )}
611
- </h1>
612
- """
613
- )
614
- if ui_args .get ("subtitle" ):
615
- gr .Markdown (
613
+ if not ui_args .get ("hide_title" ):
614
+ gr .HTML (
616
615
f"""
617
- <div style='text-align: center'>
618
- { ui_args .get ("subtitle " )}
619
- </div >
620
- """
616
+ <h1 style='text-align: center'>
617
+ { ui_args .get ("title" , "Audio Streaming (Powered by FastRTC ⚡️) " )}
618
+ </h1 >
619
+ """
621
620
)
621
+ if ui_args .get ("subtitle" ):
622
+ gr .Markdown (
623
+ f"""
624
+ <div style='text-align: center'>
625
+ { ui_args .get ("subtitle" )}
626
+ </div>
627
+ """
628
+ )
622
629
with gr .Row ():
623
630
with gr .Column ():
624
631
with gr .Group ():
@@ -662,21 +669,22 @@ def _generate_default_ui(
662
669
css = """.my-group {max-width: 600px !important; max-height: 600 !important;}
663
670
.my-column {display: flex !important; justify-content: center !important; align-items: center !important};"""
664
671
with gr .Blocks (css = css ) as demo :
665
- gr .HTML (
666
- f"""
667
- <h1 style='text-align: center'>
668
- { ui_args .get ("title" , "Audio Video Streaming (Powered by FastRTC ⚡️)" )}
669
- </h1>
670
- """
671
- )
672
- if ui_args .get ("subtitle" ):
673
- gr .Markdown (
672
+ if not ui_args .get ("hide_title" ):
673
+ gr .HTML (
674
674
f"""
675
- <div style='text-align: center'>
676
- { ui_args .get ("subtitle " )}
677
- </div >
678
- """
675
+ <h1 style='text-align: center'>
676
+ { ui_args .get ("title" , "Audio Video Streaming (Powered by FastRTC ⚡️) " )}
677
+ </h1 >
678
+ """
679
679
)
680
+ if ui_args .get ("subtitle" ):
681
+ gr .Markdown (
682
+ f"""
683
+ <div style='text-align: center'>
684
+ { ui_args .get ("subtitle" )}
685
+ </div>
686
+ """
687
+ )
680
688
with gr .Row ():
681
689
with gr .Column (elem_classes = ["my-column" ]):
682
690
with gr .Group (elem_classes = ["my-group" ]):
0 commit comments