abidlabs HF staff commited on
Commit
5b26f0a
1 Parent(s): f57a544

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -246
README.md CHANGED
@@ -1,251 +1,17 @@
1
 
2
- # `gradio_rich_textbox`
3
- <a href="https://pypi.org/project/gradio_rich_textbox/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_rich_textbox"></a>
 
 
 
 
 
 
 
4
 
5
- Gradio custom component for rich text input
6
 
7
- ## Installation
8
 
9
- ```bash
10
- pip install gradio_rich_textbox
11
- ```
12
 
13
- ## Usage
14
-
15
- ```python
16
-
17
- import gradio as gr
18
- from gradio_rich_textbox import RichTextbox
19
-
20
-
21
- example = RichTextbox().example_inputs()
22
-
23
- demo = gr.Interface(
24
- lambda x:x,
25
- RichTextbox(), # interactive version of your component
26
- RichTextbox(), # static version of your component
27
- examples=[[example]], # uncomment this line to view the "example version" of your component
28
- )
29
-
30
-
31
- if __name__ == "__main__":
32
- demo.launch()
33
-
34
- ```
35
-
36
- ## `RichTextbox`
37
-
38
- ### Initialization
39
-
40
- <table>
41
- <thead>
42
- <tr>
43
- <th align="left">name</th>
44
- <th align="left" style="width: 25%;">type</th>
45
- <th align="left">default</th>
46
- <th align="left">description</th>
47
- </tr>
48
- </thead>
49
- <tbody>
50
- <tr>
51
- <td align="left"><code>value</code></td>
52
- <td align="left" style="width: 25%;">
53
-
54
- ```python
55
- typing.Union[str, typing.Callable, NoneType][
56
- str, Callable, None
57
- ]
58
- ```
59
-
60
- </td>
61
- <td align="left"><code>""</code></td>
62
- <td align="left">default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
63
- </tr>
64
-
65
- <tr>
66
- <td align="left"><code>placeholder</code></td>
67
- <td align="left" style="width: 25%;">
68
-
69
- ```python
70
- str | None
71
- ```
72
-
73
- </td>
74
- <td align="left"><code>None</code></td>
75
- <td align="left">placeholder hint to provide behind textbox.</td>
76
- </tr>
77
-
78
- <tr>
79
- <td align="left"><code>label</code></td>
80
- <td align="left" style="width: 25%;">
81
-
82
- ```python
83
- str | None
84
- ```
85
-
86
- </td>
87
- <td align="left"><code>None</code></td>
88
- <td align="left">component name in interface.</td>
89
- </tr>
90
-
91
- <tr>
92
- <td align="left"><code>every</code></td>
93
- <td align="left" style="width: 25%;">
94
-
95
- ```python
96
- float | None
97
- ```
98
-
99
- </td>
100
- <td align="left"><code>None</code></td>
101
- <td align="left">If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.</td>
102
- </tr>
103
-
104
- <tr>
105
- <td align="left"><code>show_label</code></td>
106
- <td align="left" style="width: 25%;">
107
-
108
- ```python
109
- bool | None
110
- ```
111
-
112
- </td>
113
- <td align="left"><code>None</code></td>
114
- <td align="left">if True, will display label.</td>
115
- </tr>
116
-
117
- <tr>
118
- <td align="left"><code>scale</code></td>
119
- <td align="left" style="width: 25%;">
120
-
121
- ```python
122
- int | None
123
- ```
124
-
125
- </td>
126
- <td align="left"><code>None</code></td>
127
- <td align="left">relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.</td>
128
- </tr>
129
-
130
- <tr>
131
- <td align="left"><code>min_width</code></td>
132
- <td align="left" style="width: 25%;">
133
-
134
- ```python
135
- int
136
- ```
137
-
138
- </td>
139
- <td align="left"><code>160</code></td>
140
- <td align="left">minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.</td>
141
- </tr>
142
-
143
- <tr>
144
- <td align="left"><code>interactive</code></td>
145
- <td align="left" style="width: 25%;">
146
-
147
- ```python
148
- bool | None
149
- ```
150
-
151
- </td>
152
- <td align="left"><code>None</code></td>
153
- <td align="left">if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.</td>
154
- </tr>
155
-
156
- <tr>
157
- <td align="left"><code>visible</code></td>
158
- <td align="left" style="width: 25%;">
159
-
160
- ```python
161
- bool
162
- ```
163
-
164
- </td>
165
- <td align="left"><code>True</code></td>
166
- <td align="left">If False, component will be hidden.</td>
167
- </tr>
168
-
169
- <tr>
170
- <td align="left"><code>rtl</code></td>
171
- <td align="left" style="width: 25%;">
172
-
173
- ```python
174
- bool
175
- ```
176
-
177
- </td>
178
- <td align="left"><code>False</code></td>
179
- <td align="left">If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.</td>
180
- </tr>
181
-
182
- <tr>
183
- <td align="left"><code>elem_id</code></td>
184
- <td align="left" style="width: 25%;">
185
-
186
- ```python
187
- str | None
188
- ```
189
-
190
- </td>
191
- <td align="left"><code>None</code></td>
192
- <td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
193
- </tr>
194
-
195
- <tr>
196
- <td align="left"><code>elem_classes</code></td>
197
- <td align="left" style="width: 25%;">
198
-
199
- ```python
200
- list[str] | str | None
201
- ```
202
-
203
- </td>
204
- <td align="left"><code>None</code></td>
205
- <td align="left">An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
206
- </tr>
207
-
208
- <tr>
209
- <td align="left"><code>render</code></td>
210
- <td align="left" style="width: 25%;">
211
-
212
- ```python
213
- bool
214
- ```
215
-
216
- </td>
217
- <td align="left"><code>True</code></td>
218
- <td align="left">If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>
219
- </tr>
220
- </tbody></table>
221
-
222
-
223
- ### Events
224
-
225
- | name | description |
226
- |:-----|:------------|
227
- | `change` | Triggered when the value of the RichTextbox changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
228
- | `input` | This listener is triggered when the user changes the value of the RichTextbox. |
229
- | `submit` | This listener is triggered when the user presses the Enter key while the RichTextbox is focused. |
230
-
231
-
232
-
233
- ### User function
234
-
235
- The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
236
-
237
- - When used as an Input, the component only impacts the input signature of the user function.
238
- - When used as an output, the component only impacts the return signature of the user function.
239
-
240
- The code snippet below is accurate in cases where the component is used as both an input and an output.
241
-
242
- - **As output:** Is passed, text.
243
- - **As input:** Should return, function output to postprocess.
244
-
245
- ```python
246
- def predict(
247
- value: str | None
248
- ) -> str | None:
249
- return value
250
- ```
251
-
 
1
 
2
+ ---
3
+ tags: [gradio-custom-component,machine learning,reproducibility,visualization,gradio,gradio-template-SimpleTextbox]
4
+ title: gradio_rich_textbox V0.4.3
5
+ colorFrom: indigo
6
+ colorTo: purple
7
+ sdk: docker
8
+ pinned: false
9
+ license: apache-2.0
10
+ ---
11
 
 
12
 
13
+ # Name: gradio_rich_textbox
14
 
15
+ Description: Gradio custom component for rich text input
 
 
16
 
17
+ Install with: pip install gradio_rich_textbox