Spaces:
Runtime error
Runtime error
hobs
commited on
Commit
·
f15ddc1
1
Parent(s):
5623a49
add textbox labels
Browse files
app.py
CHANGED
@@ -111,12 +111,18 @@ routes.get_types = get_types
|
|
111 |
|
112 |
with gr.Blocks() as html_block:
|
113 |
gr.Markdown("# Gradio Blocks (3.0) with REST API")
|
114 |
-
|
|
|
|
|
|
|
115 |
button_text2int = gr.Button("text2int")
|
116 |
button_text2int_preprocessed = gr.Button("text2int with preprocessing")
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
120 |
gr.Markdown(r"""
|
121 |
|
122 |
## API
|
@@ -138,7 +144,7 @@ curl -X POST https://Hobson-gradio-rest-api.hf.space/api/predict/ -H 'Content-Ty
|
|
138 |
```
|
139 |
""")
|
140 |
|
141 |
-
interface = gr.Interface(lambda: None, inputs=[
|
142 |
|
143 |
html_block.input_components = interface.input_components
|
144 |
html_block.output_components = interface.output_components
|
|
|
111 |
|
112 |
with gr.Blocks() as html_block:
|
113 |
gr.Markdown("# Gradio Blocks (3.0) with REST API")
|
114 |
+
textbox_input = gr.Textbox(
|
115 |
+
value="forty-two",
|
116 |
+
label="Input number words:",
|
117 |
+
)
|
118 |
button_text2int = gr.Button("text2int")
|
119 |
button_text2int_preprocessed = gr.Button("text2int with preprocessing")
|
120 |
+
textbox_output = gr.Textbox(
|
121 |
+
value="42",
|
122 |
+
label="Output integer:"
|
123 |
+
)
|
124 |
+
button_text2int.click(text2int, inputs=[textbox_input], outputs=[textbox_output])
|
125 |
+
button_text2int_preprocessed.click(text2int_preprocessed, inputs=[textbox_input], outputs=[textbox_output])
|
126 |
gr.Markdown(r"""
|
127 |
|
128 |
## API
|
|
|
144 |
```
|
145 |
""")
|
146 |
|
147 |
+
interface = gr.Interface(lambda: None, inputs=[textbox_input], outputs=[textbox_output])
|
148 |
|
149 |
html_block.input_components = interface.input_components
|
150 |
html_block.output_components = interface.output_components
|