test_gradio / app.py
John Smith
Update app.py
6caaed0
raw
history blame
1.31 kB
import gradio as gr
def sentence_builder(quantity, animal, countries, place, activity_list, morning):
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"}"""
demo = gr.Interface(
sentence_builder,
[
gr.Slider(2009, 2023, value=2009, label="Count", info="Choose a year between 2009 and 2023"),
gr.Slider(0, 120167, value=0, label="Count", info="Enter mileage between 0 and 120167"),
gr.Dropdown(
["cat", "dog", "bird"], label="Animal", info="Will add more animals later!"
),
gr.CheckboxGroup(["USA", "Japan", "Pakistan"], label="Countries", info="Where are they from?"),
gr.Dropdown(
["cat", "dog", "bird"], label="Animal", info="Will add more animals later!"
),
gr.Checkbox(label="Morning", info="Did they do it in the morning?"),
],
"text",
#examples=[
# [2, "cat", ["Japan", "Pakistan"], "park", ["ate", "swam"], True],
# [4, "dog", ["Japan"], "zoo", ["ate", "swam"], False],
# [10, "bird", ["USA", "Pakistan"], "road", ["ran"], False],
# [8, "cat", ["Pakistan"], "zoo", ["ate"], True],
#]
)
if __name__ == "__main__":
demo.launch()