@@ -59,6 +59,8 @@ class UIArgs(TypedDict):
5959 If "submit", the input will be sent when the submit event is triggered by the user.
6060 If "change", the input will be sent whenever the user changes the input value.
6161 """
62+ hide_title : NotRequired [bool ]
63+ """If True, the title and subtitle will not be displayed."""
6264
6365
6466class Stream (WebRTCConnectionMixin ):
@@ -339,21 +341,22 @@ def _generate_default_ui(
339341 same_components .append (component )
340342 if self .modality == "video" and self .mode == "receive" :
341343 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 (
351346 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+ """
356351 )
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+ )
357360 with gr .Row ():
358361 with gr .Column ():
359362 if additional_input_components :
@@ -391,21 +394,22 @@ def _generate_default_ui(
391394 )
392395 elif self .modality == "video" and self .mode == "send" :
393396 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 (
403399 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+ """
408404 )
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+ )
409413 with gr .Row ():
410414 if additional_input_components :
411415 with gr .Column ():
@@ -494,21 +498,22 @@ def _generate_default_ui(
494498 )
495499 elif self .modality == "audio" and self .mode == "receive" :
496500 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 (
506503 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+ """
511508 )
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+ )
512517 with gr .Row ():
513518 with gr .Column ():
514519 for component in additional_input_components :
@@ -549,21 +554,22 @@ def _generate_default_ui(
549554 )
550555 elif self .modality == "audio" and self .mode == "send" :
551556 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 (
561559 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+ """
566564 )
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+ )
567573 with gr .Row ():
568574 with gr .Column ():
569575 with gr .Group ():
@@ -604,21 +610,22 @@ def _generate_default_ui(
604610 )
605611 elif self .modality == "audio" and self .mode == "send-receive" :
606612 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 (
616615 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+ """
621620 )
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+ )
622629 with gr .Row ():
623630 with gr .Column ():
624631 with gr .Group ():
@@ -662,21 +669,22 @@ def _generate_default_ui(
662669 css = """.my-group {max-width: 600px !important; max-height: 600 !important;}
663670 .my-column {display: flex !important; justify-content: center !important; align-items: center !important};"""
664671 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 (
674674 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+ """
679679 )
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+ )
680688 with gr .Row ():
681689 with gr .Column (elem_classes = ["my-column" ]):
682690 with gr .Group (elem_classes = ["my-group" ]):
0 commit comments