Spaces:
Runtime error
Runtime error
File size: 842 Bytes
ef371a3 447bf74 ef371a3 4c1ab07 ef371a3 4c1ab07 447bf74 4c1ab07 ef371a3 447bf74 eaeeae2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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()
|