Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| # Code to greet | |
| def greet(name, is_morning, temperature): | |
| salutation = "Good morning" if is_morning else "Good evening" | |
| greeting = f"{salutation} {name}. It is {temperature} degrees today" | |
| celsius = (temperature - 32) * 5 / 9 | |
| return greeting, round(celsius, 2) | |
| iface = gr.Interface( | |
| fn=greet, | |
| inputs=["text", "checkbox", gr.Slider(0, 100)], | |
| outputs=["text", "number"], | |
| title="Greeting" | |
| ) | |
| iface.launch() | |
| # Code to flip a text | |
| # def flip_text(x): | |
| # return x[::-1] | |
| # with gr.Blocks() as demo: | |
| # gr.Markdown("Flip text using this demo.") | |
| # with gr.Tab("Flip Text"): | |
| # text_input = gr.Textbox() | |
| # text_output = gr.Textbox() | |
| # text_button = gr.Button("Flip") | |
| # text_button.click(flip_text, inputs=text_input, outputs=text_output) | |
| # demo.launch() | |