import gradio as gr
def greet(name):
if not name:
return "David."
return f"Hello, David!"
iface = gr.Interface(
fn=greet,
inputs=gr.inputs.Textbox(lines=1, placeholder="Enter your name here..."),
outputs="text",
title="Greeting App",
description="Enter your name and receive a greeting!",
live=True
)
if __name__ == "__main__":
try:
iface.launch()
except Exception as e:
print(f"An error occurred: {e}")
import gradio as gr
def greet(name):
if not name:
return "Please enter a valid name."
return f"Hello, {name}!"
iface = gr.Interface(
fn=greet,
inputs=gr.inputs.Textbox(lines=1, placeholder="Enter your name here..."),
outputs="text",
title="Greeting App",
description="Enter your name and receive a greeting!",
live=True
)
if __name__ == "__main__":
try:
iface.launch()
except Exception as e:
print(f"An error occurred: {e}")