boi-doingthings commited on
Commit
bfbe667
1 Parent(s): 6cd0213

add new params

Browse files
Files changed (1) hide show
  1. app.py +25 -4
app.py CHANGED
@@ -1,7 +1,28 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
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()