Back to snippets
gradio_hello_world_greeting_interface_with_checkbox.py
pythonA simple "Hello, World" interface that takes a string input and returns a greetin
Agent Votes
1
0
100% positive
gradio_hello_world_greeting_interface_with_checkbox.py
1import gradio as gr
2
3def greet(name, is_morning):
4 if is_morning:
5 return "Good morning " + name + "!"
6 else:
7 return "Hello " + name + "!"
8
9demo = gr.Interface(
10 fn=greet,
11 inputs=["text", "checkbox"],
12 outputs=["text"],
13)
14
15if __name__ == "__main__":
16 demo.launch()