Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from utils.bgg import get_game_details, get_hot_games, get_similar_games_v2, search
|
|
|
3 |
|
4 |
|
5 |
search_bgg = gr.Interface(
|
@@ -34,9 +35,24 @@ recommend_games = gr.Interface(
|
|
34 |
description="Get a list of similar games based on a given game ID"
|
35 |
)
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
)
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from utils.bgg import get_game_details, get_hot_games, get_similar_games_v2, search
|
3 |
+
from utils.wikipedia_tools import search_wiki, summary_wiki, page_wiki, random_wiki
|
4 |
|
5 |
|
6 |
search_bgg = gr.Interface(
|
|
|
35 |
description="Get a list of similar games based on a given game ID"
|
36 |
)
|
37 |
|
38 |
+
# ----- Wikipedia Interfaces -----
|
39 |
+
wiki_search = gr.Interface(fn=search_wiki, inputs=["text", "text"], outputs="json", title="Wikipedia Search", description="Search Wikipedia and return summaries")
|
40 |
+
wiki_summary = gr.Interface(fn=summary_wiki, inputs=["text", "text"], outputs="text", title="Summary", description="Get a summary of a Wikipedia topic")
|
41 |
+
wiki_page = gr.Interface(fn=page_wiki, inputs=["text", "text"], outputs="text", title="Full Page", description="Get full content of a topic")
|
42 |
+
wiki_random = gr.Interface(fn=random_wiki, inputs=["text"], outputs="text", title="Random Page", description="Get a random Wikipedia article")
|
43 |
+
|
44 |
+
# ----- Combine All Tabs -----
|
45 |
+
combined_tools = gr.TabbedInterface(
|
46 |
+
[search_bgg, game_details, hot_games, recommend_games, wiki_search, wiki_summary, wiki_page, wiki_random],
|
47 |
+
["Search BGG", "Details", "Hot Games", "Recommend", "Wiki Search", "Wiki Summary", "Wiki Page", "Wiki Random"]
|
48 |
)
|
49 |
|
50 |
+
# ----- Launch MCP-enabled Gradio Server -----
|
51 |
+
combined_tools.launch(mcp_server=True)
|
52 |
+
|
53 |
+
#bgg_tools = gr.TabbedInterface(
|
54 |
+
#[search_bgg, game_details, hot_games, recommend_games],
|
55 |
+
#["Search", "Details", "Hot Games", "Recommend Games"]
|
56 |
+
#)
|
57 |
+
|
58 |
+
#bgg_tools.launch(mcp_server=True)
|