mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-09 02:00:44 +08:00
8aba1c991b
* Explicitly set value and add to docs * Fix wording a bit * Remove sentence that's not adding much * Remove extra word * Delete screenshot
28 lines
804 B
Python
28 lines
804 B
Python
import gradio as gr
|
|
|
|
|
|
def sentence_builder(quantity, animal, place, activity_list, morning):
|
|
return f"""The {quantity} {animal}s went to the {place} where they {" and ".join(activity_list)} until the {"morning" if morning else "night"}"""
|
|
|
|
|
|
demo = gr.Interface(
|
|
sentence_builder,
|
|
[
|
|
gr.Slider(2, 20, value=4),
|
|
gr.Dropdown(["cat", "dog", "bird"]),
|
|
gr.Radio(["park", "zoo", "road"]),
|
|
gr.CheckboxGroup(["ran", "swam", "ate", "slept"]),
|
|
gr.Checkbox(label="Is it the morning?"),
|
|
],
|
|
"text",
|
|
examples=[
|
|
[2, "cat", "park", ["ran", "swam"], True],
|
|
[4, "dog", "zoo", ["ate", "swam"], False],
|
|
[10, "bird", "road", ["ran"], False],
|
|
[8, "cat", "zoo", ["ate"], True],
|
|
],
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
demo.launch()
|