File size: 718 Bytes
fe2f058
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from web_scraper import search_your_product


def product_search(query: str) -> str:
    """
    Search for products based on the provided query.

    Args:
        query (str): The search query for products.

    Returns:
        str: A message with the search results.
    """

    results = search_your_product(query)
    if not results:
        return f"No products found for your search: '{query}'. Please try a different query."
    return f"Here are the products matching your search for '{query}': {results}."




demo = gr.Interface(fn=product_search,
                    inputs=[],
                    outputs="number")
demo.launch(mcp_server=True)   # exposes an MCP schema automatically