mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-09 02:00:44 +08:00
18 lines
459 B
Python
18 lines
459 B
Python
import gradio as gr
|
|
|
|
|
|
def greet(name, is_morning, temperature):
|
|
salutation = "Good morning" if is_morning else "Good evening"
|
|
greeting = "%s %s. It is %s degrees today" % (salutation, name, temperature)
|
|
celsius = (temperature - 32) * 5 / 9
|
|
return greeting, round(celsius, 2)
|
|
|
|
|
|
demo = gr.Interface(
|
|
fn=greet,
|
|
inputs=["text", "checkbox", gr.Slider(0, 100)],
|
|
outputs=["text", "number"],
|
|
)
|
|
if __name__ == "__main__":
|
|
demo.launch()
|