Spaces:
Runtime error
Runtime error
azaninello
commited on
Commit
•
6616039
1
Parent(s):
931bd35
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.Dropdown(["cat", "dog", "bird"]),
|
12 |
+
gr.Radio(["park", "zoo", "road"]),
|
13 |
+
gr.CheckboxGroup(["ran", "swam", "ate", "slept"]),
|
14 |
+
gr.Checkbox(label="Is it the morning?"),
|
15 |
+
],
|
16 |
+
"text",
|
17 |
+
examples=[
|
18 |
+
[2, "cat", "park", ["ran", "swam"], True],
|
19 |
+
[4, "dog", "zoo", ["ate", "swam"], False],
|
20 |
+
[10, "bird", "road", ["ran"], False],
|
21 |
+
[8, "cat", "zoo", ["ate"], True],
|
22 |
+
],
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.launch()
|