Spaces:
Sleeping
Sleeping
File size: 2,439 Bytes
b93edd8 328a89d a3c94e6 f80715b b93edd8 328a89d a3c94e6 f80715b 23a3758 a3c94e6 f45a3d5 328a89d a3c94e6 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
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) |