Spaces:
Sleeping
Sleeping
import gradio as gr | |
from utils.bgg import get_game_details, get_hot_games, get_similar_games_v2, search | |
from utils.wikipedia_tools import search_wiki, summary_wiki, page_wiki, random_wiki | |
from utils.imdb_tools import search_imdb | |
search_bgg = gr.Interface( | |
fn=search, | |
inputs=["text"], | |
outputs="json", | |
title="Board game geek search", | |
description="Search for the board games from Board Game Geek" | |
) | |
game_details = gr.Interface( | |
fn=get_game_details, | |
inputs=["text"], | |
outputs="json", | |
title="Game Details", | |
description="Get detailed information for board games (comma-separated IDs)" | |
) | |
hot_games = gr.Interface( | |
fn=get_hot_games, | |
inputs=[], | |
outputs="json", | |
title="Hot Games", | |
description="Get the list of the top 50 trending games today on Board Game Geek" | |
) | |
recommend_games = gr.Interface( | |
fn=get_similar_games_v2, | |
inputs=["text"], | |
outputs="json", | |
title="Recommend Games", | |
description="Get a list of similar games based on a given game ID" | |
) | |
# ----- Wikipedia Interfaces ----- | |
wiki_search = gr.Interface(fn=search_wiki, inputs=["text", "text"], outputs="json", title="Wikipedia Search", description="Search Wikipedia and return summaries") | |
wiki_summary = gr.Interface(fn=summary_wiki, inputs=["text", "text"], outputs="text", title="Summary", description="Get a summary of a Wikipedia topic") | |
wiki_page = gr.Interface(fn=page_wiki, inputs=["text", "text"], outputs="text", title="Full Page", description="Get full content of a topic") | |
wiki_random = gr.Interface(fn=random_wiki, inputs=["text"], outputs="text", title="Random Page", description="Get a random Wikipedia article") | |
imdb_interface = gr.Interface( | |
fn=search_imdb, | |
inputs="text", | |
outputs="json", | |
title="IMDb Movie Search", | |
description="Search IMDb for movie details." | |
) | |
# ----- Combine All Tabs ----- | |
combined_tools = gr.TabbedInterface( | |
[search_bgg, game_details, hot_games, recommend_games, wiki_search, wiki_summary, wiki_page, wiki_random, imdb_interface], | |
["Search BGG", "Details", "Hot Games", "Recommend", "Wiki Search", "Wiki Summary", "Wiki Page", "Wiki Random", "IMDb Search"] | |
) | |
# ----- Launch MCP-enabled Gradio Server ----- | |
combined_tools.launch(mcp_server=True) | |
#bgg_tools = gr.TabbedInterface( | |
#[search_bgg, game_details, hot_games, recommend_games], | |
#["Search", "Details", "Hot Games", "Recommend Games"] | |
#) | |
#bgg_tools.launch(mcp_server=True) |