Spaces:
Runtime error
Runtime error
Create initial template app
Browse files
app.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()
|