Decorator
gui(name=None, command_name='gui', message='Launch the GUI.', *, theme='soft', hide_not_required=False, allow_file_download=False, launch_kwargs=None, queue_kwargs=None, catch_errors=True)
Creates a decorator for a click command or group to add a GUI interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str]
|
The name of the application. Defaults to None. |
None
|
command_name |
str
|
The name of the command to open the GUI. Defaults to "gui". |
'gui'
|
message |
str
|
The message to display when the GUI is opened. Defaults to "Open Gradio GUI." |
'Launch the GUI.'
|
theme |
GradioTheme | str
|
The theme to use for the GUI. Defaults to Soft. |
'soft'
|
hide_not_required |
bool
|
Whether to hide options that are not required. Defaults to False. |
False
|
allow_file_download |
bool
|
Whether to allow file downloads. Defaults to False. |
False
|
launch_kwargs |
Optional[dict]
|
Additional keyword arguments to pass to the launch method. Defaults to None. |
None
|
queue_kwargs |
Optional[dict]
|
Additional keyword arguments to pass to the queue method. Defaults to None. |
None
|
catch_errors |
bool
|
Whether to catch and display errors in the GUI. Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
Callable |
Callable
|
A decorator that can be used to add a GUI to a click command or group. |
Source code in src/guigaga/decorator.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
update_launch_kwargs_from_cli(ctx, launch_kwargs, cli_mappings)
Update launch_kwargs with CLI options that differ from their defaults.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx |
Click context object containing the command parameters and options. |
required | |
launch_kwargs |
Dictionary to update with CLI-specified values. |
required | |
cli_mappings |
Dictionary mapping CLI option names to their corresponding launch_kwargs keys. |
required |