aliabd HF staff commited on
Commit
005d317
1 Parent(s): b9e2029

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +1 -2
  2. run.py +27 -0
README.md CHANGED
@@ -6,7 +6,6 @@ colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
-
10
- app_file: app.py
11
  pinned: false
12
  ---
 
6
  colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 3.4.1
9
+ app_file: run.py
 
10
  pinned: false
11
  ---
run.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def sentence_builder(quantity, animal, place, activity_list, morning):
5
+ return f"""The {quantity} {animal}s went to the {place} where they {" and ".join(activity_list)} until the {"morning" if morning else "night"}"""
6
+
7
+
8
+ demo = gr.Interface(
9
+ sentence_builder,
10
+ [
11
+ gr.Slider(2, 20, value=4),
12
+ gr.Dropdown(["cat", "dog", "bird"]),
13
+ gr.Radio(["park", "zoo", "road"]),
14
+ gr.CheckboxGroup(["ran", "swam", "ate", "slept"]),
15
+ gr.Checkbox(label="Is it the morning?"),
16
+ ],
17
+ "text",
18
+ examples=[
19
+ [2, "cat", "park", ["ran", "swam"], True],
20
+ [4, "dog", "zoo", ["ate", "swam"], False],
21
+ [10, "bird", "road", ["ran"], False],
22
+ [8, "cat", "zoo", ["ate"], True],
23
+ ],
24
+ )
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch()