Spaces:
Sleeping
Sleeping
boi-doingthings
commited on
Commit
•
bfbe667
1
Parent(s):
6cd0213
add new params
Browse files
app.py
CHANGED
@@ -1,7 +1,28 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
iface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
# Define a function that takes the input parameters and returns a result
|
4 |
+
def analyze_person(sex, age, height, weight):
|
5 |
+
# You can perform any processing or analysis here based on the input parameters
|
6 |
+
# For this example, we'll simply return the input parameters as a dictionary
|
7 |
+
result = {
|
8 |
+
"Sex": sex,
|
9 |
+
"Age": age,
|
10 |
+
"Height": height,
|
11 |
+
"Weight": weight
|
12 |
+
}
|
13 |
+
return result
|
14 |
|
15 |
+
# Define the Gradio interface
|
16 |
+
iface = gr.Interface(
|
17 |
+
fn=analyze_person, # Function to call with input parameters
|
18 |
+
inputs=[
|
19 |
+
gr.inputs.Radio(["Male", "Female"], label="Sex"), # Radio button for sex
|
20 |
+
gr.inputs.Number(label="Age"), # Numeric input for age
|
21 |
+
gr.inputs.Number(label="Height (cm)"), # Numeric input for height
|
22 |
+
gr.inputs.Number(label="Weight (kg)") # Numeric input for weight
|
23 |
+
],
|
24 |
+
outputs=gr.outputs.JSON() # Display the result as JSON
|
25 |
+
)
|
26 |
+
|
27 |
+
# Start the Gradio interface
|
28 |
+
iface.launch()
|