File size: 621 Bytes
bd25cd9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c4f0a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr

def greet_user(name):
    """Function to greet the user with their name"""
    if name.strip():
        return f"Hello, {name}! Nice to meet you!"
    else:
        return "Hello! Please enter your name to get a personalized greeting."

# Create the Gradio interface
interface = gr.Interface(
    fn=greet_user,
    inputs=gr.Textbox(label="Enter your name", placeholder="Type your name here..."),
    outputs=gr.Textbox(label="Greeting"),
    title="AI Greeter",
    description="Enter your name and I'll give you a friendly greeting!"
)

if __name__ == "__main__":
    interface.launch(share=True)