alessandro trinca tornidor commited on
Commit
1cf84e9
1 Parent(s): a09b191

feat: add examples support

Browse files
Files changed (1) hide show
  1. app.py +15 -12
app.py CHANGED
@@ -19,22 +19,25 @@ CUSTOM_GRADIO_PATH = "/"
19
  def get_gradio_app():
20
  with gr.Blocks() as gradio_app:
21
  gr.Markdown(
22
- """
23
- # Hello World!
24
-
25
- Start typing below to _see_ the *output*.
26
 
27
- Here a [link](https://huggingface.co/spaces/aletrn/gradio_with_fastapi).
28
- """)
 
29
  btn = gr.Button(value="Divide et Impera")
 
 
 
 
 
 
30
  btn.click(
31
  formatters.request_formatter,
32
- inputs=[
33
- gr.Textbox(lines=1, placeholder="10", label="write an integer to divide 100; 0 will raise ZeroDivisionError")
34
- ],
35
- outputs=[
36
- gr.Textbox(lines=1, placeholder=None, label="Text Output")
37
- ]
38
  )
39
  return gradio_app
40
 
 
19
  def get_gradio_app():
20
  with gr.Blocks() as gradio_app:
21
  gr.Markdown(
22
+ """
23
+ # Hello World!
24
+
25
+ Start typing below to _see_ the *output*.
26
 
27
+ Here a [link](https://huggingface.co/spaces/aletrn/gradio_with_fastapi).
28
+ """
29
+ )
30
  btn = gr.Button(value="Divide et Impera")
31
+ text_input = gr.Textbox(lines=1, placeholder="10", label="write an integer to divide 100; 0 will raise ZeroDivisionError")
32
+ text_output = gr.Textbox(lines=1, placeholder=None, label="Text Output")
33
+ examples = gr.Examples(
34
+ examples=[33, 1, -7, 0],
35
+ inputs=[text_input],
36
+ )
37
  btn.click(
38
  formatters.request_formatter,
39
+ inputs=[text_input],
40
+ outputs=[text_output]
 
 
 
 
41
  )
42
  return gradio_app
43