tnt306 commited on
Commit
86bff09
·
1 Parent(s): da09203

Test Dataframe

Browse files
Files changed (1) hide show
  1. app.py +17 -18
app.py CHANGED
@@ -14,24 +14,23 @@ title = "This is title."
14
  description = "This is description."
15
  article = "This is article."
16
 
17
- def sentence_builder(quantity, animal, countries, place, activity_list, morning):
18
- return f"""The {quantity} {animal}s from {" and ".join(countries)} went to the {place} where they {" and ".join(activity_list)} until the {"morning" if morning else "night"}"""
19
-
20
- with gr.Blocks() as demo:
21
- with gr.Row():
22
- text1 = gr.Textbox(label="t1")
23
- slider2 = gr.Textbox(label="s2")
24
- drop3 = gr.Dropdown(["a", "b", "c"], label="d3")
25
- with gr.Row():
26
- with gr.Column(scale=1, min_width=300):
27
- text1 = gr.Textbox(label="prompt 1")
28
- text2 = gr.Textbox(label="prompt 2")
29
- inbtw = gr.Button("Between")
30
- text4 = gr.Textbox(label="prompt 1")
31
- text5 = gr.Textbox(label="prompt 2")
32
- with gr.Column(scale=2, min_width=300):
33
- img1 = gr.Image("images/cheetah.jpg")
34
- btn = gr.Button("Go")
35
 
36
  demo.launch(debug=False,
37
  share=True)
 
14
  description = "This is description."
15
  article = "This is article."
16
 
17
+ def filter_records(records, gender):
18
+ return records[records["gender"] == gender]
19
+
20
+ demo = gr.Interface(
21
+ filter_records,
22
+ [
23
+ gr.Dataframe(
24
+ headers=["name", "age", "gender"],
25
+ datatype=["str", "number", "str"],
26
+ row_count=5,
27
+ col_count=(3, "fixed"),
28
+ ),
29
+ gr.Dropdown(["M", "F", "O"]),
30
+ ],
31
+ "dataframe",
32
+ description="Enter gender as 'M', 'F', or 'O' for other.",
33
+ )
 
34
 
35
  demo.launch(debug=False,
36
  share=True)