File size: 840 Bytes
afd4f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
acac713
 
afd4f00
acac713
afd4f00
 
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
import gradio as gr

def create_greeting_message(user_name: str, tone: str) -> str:
    """
    Creates a friendly or hostile user message for a user
    Args:
      user_name: the name of the user that needs a greeting message
      tone: choose between "friendly" and "hostile"
    Returns:
      A string with the user message 
    """

    if tone == "friendly":
       greeting_msg = "Great to have you here  " + user_name
    elif tone == "hostile":
      greeting_msg = "Ehm, soo cool to have you here  " + user_name
    else:
      greeting_msg = "wrong argument for tone"
    
    return greeting_msg

demo = gr.Interface(
    fn=create_greeting_message,
    inputs=[gr.Textbox(label="user_name"), gr.Textbox(label="tone")],
    outputs=[gr.Textbox(label="Result")],
    title="create user greetings"
)
demo.launch(mcp_server=True)