ziem-io commited on
Commit
ac240ce
·
1 Parent(s): b50e3d3

New: Add proper input form

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -1,7 +1,20 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def predict(review: str, display_mode: str):
4
+ return review + " | " + display_mode
5
 
6
+ iface = gr.Interface(
7
+ fn=predict,
8
+ inputs=[
9
+ gr.Textbox(label="Whisky Review", lines=8, placeholder="Nose: peat smoke, sherry and vanilla..."),
10
+ gr.Dropdown(label="Display mode", choices=["table", "JSON"], value="table"),
11
+ ],
12
+ outputs=[
13
+ gr.HTML(label="Table"),
14
+ gr.JSON(label="JSON"),
15
+ ],
16
+ title="Submit Whisky Review for Classification",
17
+ description="Paste an English whisky review, choose display mode, then submit.",
18
+ )
19
+
20
+ iface.launch()