Navneetkumar11 commited on
Commit
f147e7d
·
verified ·
1 Parent(s): c53fe55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -25
app.py CHANGED
@@ -1,37 +1,27 @@
1
  import gradio as gr
2
- from gradio_client import Client
3
 
4
- # This client connects to a language model that can write text
5
- llm_client = Client("hysts/zephyr-7b")
6
-
7
- def create_compliment(text_description: str) -> str:
8
  """
9
- Takes a text description of a scene and turns it into a fun, friendly compliment.
10
 
11
  Args:
12
- text_description: A description of what is in a picture.
 
13
  """
14
- prompt = f"Please turn the following description into a short, fun, and friendly compliment: {text_description}"
15
-
16
- # We send the prompt to the language model to get our final result.
17
- # CORRECTED api_name from "/add_text" to "/predict"
18
- compliment = llm_client.predict(
19
- prompt=prompt,
20
- max_new_tokens=128,
21
- api_name="/predict"
22
- )
23
-
24
- return compliment
25
 
26
- # Create the Gradio interface
27
  iface = gr.Interface(
28
- fn=create_compliment,
29
- inputs=gr.Textbox(label="Describe a scene or person"),
30
- outputs=gr.Textbox(label="Generated Compliment"),
31
- title="The Complimenter Tool",
32
- description="An MCP server that generates compliments from text descriptions. [1, 2]"
 
 
 
33
  )
34
 
35
- # Launch the app as an MCP server
36
  if __name__ == "__main__":
37
  iface.launch(mcp_server=True)
 
1
  import gradio as gr
 
2
 
3
+ def add_numbers(a: float, b: float) -> float:
 
 
 
4
  """
5
+ Adds two numbers together.
6
 
7
  Args:
8
+ a: The first number.
9
+ b: The second number.
10
  """
11
+ return a + b
 
 
 
 
 
 
 
 
 
 
12
 
13
+ # Create a simple interface for our tool
14
  iface = gr.Interface(
15
+ fn=add_numbers,
16
+ inputs=[
17
+ gr.Number(label="First Number"),
18
+ gr.Number(label="Second Number")
19
+ ],
20
+ outputs=gr.Number(label="Sum"),
21
+ title="Addition MCP Server",
22
+ description="A simple MCP tool that adds two numbers. [1, 2]"
23
  )
24
 
25
+ # Launch the app as an MCP server. This is the most important part.
26
  if __name__ == "__main__":
27
  iface.launch(mcp_server=True)