Merlijn
commited on
Commit
·
1e8d0b0
1
Parent(s):
b773934
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,18 @@
|
|
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 |
-
|
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=["text", "text", "text", "text"], outputs="text", api_name="predict_length")
|
16 |
-
|
17 |
-
|
18 |
-
# Launch the interface
|
19 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
def predict_length(sep_length, sep_width, pet_length, pet_width):
|
4 |
return f"Sepal Length: {sep_length}, Sepal Width: {sep_width}, Petal Length: {pet_length}, Petal Width: {pet_width}"
|
5 |
|
6 |
+
iface = gr.Interface(
|
7 |
+
fn=predict_length,
|
8 |
+
inputs=[
|
9 |
+
gr.Textbox(label="Sepal Length"),
|
10 |
+
gr.Textbox(label="Sepal Width"),
|
11 |
+
gr.Textbox(label="Petal Length"),
|
12 |
+
gr.Textbox(label="Petal Width"),
|
13 |
+
],
|
14 |
+
outputs="text",
|
15 |
+
live=True
|
16 |
+
)
|
17 |
|
18 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|