Merlijn commited on
Commit
eac07ff
·
1 Parent(s): 6c5f1d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1,10 +1,19 @@
1
  import gradio as gr
2
 
3
 
4
- def greet(sep_length, sep_width, pet_length, pet_width):
5
  return f"Sepal Length: {sep_length}, Sepal Width: {sep_width}, Petal Length: {pet_length}, Petal Width: {pet_width}"
6
 
7
 
 
 
 
 
 
 
 
 
 
 
8
  # Launch the interface
9
- iface = gr.Interface(fn=greet, inputs=["text", "text", "text", "text" ], outputs="text")
10
  iface.launch()
 
1
  import gradio as gr
2
 
3
 
4
+ def predict_length(sep_length, sep_width, pet_length, pet_width):
5
  return f"Sepal Length: {sep_length}, Sepal Width: {sep_width}, Petal Length: {pet_length}, Petal Width: {pet_width}"
6
 
7
 
8
+ with gr.Blocks() as iface:
9
+ sep_length = gr.Textbox(label="Sepal Length")
10
+ sep_width = gr.Textbox(label="Sepal Width")
11
+ pet_length = gr.Textbox(label="Petal Length")
12
+ pet_width = gr.Textbox(label="Petal Width")
13
+
14
+ button = gr.Button(label="Predict")
15
+ button.click(fn=predict_length, inputs=[sep_length, sep_width, pet_length, pet_width] outputs="text", api_name="predict_length")
16
+
17
+
18
  # Launch the interface
 
19
  iface.launch()