No longer hiding non-functional tools from using-facing UI, they are still hidden as MCP tools
Browse files
app.py
CHANGED
|
@@ -1067,7 +1067,7 @@ CSS_STYLES = """
|
|
| 1067 |
}
|
| 1068 |
.gradio-container h1::after {
|
| 1069 |
grid-row: 3;
|
| 1070 |
-
content: "Authentication is optional
|
| 1071 |
display: block;
|
| 1072 |
font-size: 1rem;
|
| 1073 |
font-weight: 400;
|
|
@@ -1214,6 +1214,8 @@ memory_interface = gr.Interface(
|
|
| 1214 |
"Use Memory_Manager whenever you are given information worth remembering about the user, and search for memories when relevant."
|
| 1215 |
),
|
| 1216 |
flagging_mode="never",
|
|
|
|
|
|
|
| 1217 |
)
|
| 1218 |
|
| 1219 |
# ==========================
|
|
@@ -1339,6 +1341,8 @@ image_generation_interface = gr.Interface(
|
|
| 1339 |
"Returns a PIL.Image. Return the generated media to the user in this format ``"
|
| 1340 |
),
|
| 1341 |
flagging_mode="never",
|
|
|
|
|
|
|
| 1342 |
)
|
| 1343 |
|
| 1344 |
# ==========================
|
|
@@ -1529,36 +1533,29 @@ video_generation_interface = gr.Interface(
|
|
| 1529 |
"Return the generated media to the user in this format ``"
|
| 1530 |
),
|
| 1531 |
flagging_mode="never",
|
|
|
|
|
|
|
| 1532 |
)
|
| 1533 |
|
| 1534 |
-
# Build tabbed app; disable Image/Video tools if no HF token is present
|
| 1535 |
-
HAS_HF_TOKEN = bool(HF_API_TOKEN or HF_VIDEO_TOKEN)
|
| 1536 |
-
|
| 1537 |
_interfaces = [
|
| 1538 |
fetch_interface,
|
| 1539 |
concise_interface,
|
| 1540 |
code_interface,
|
|
|
|
| 1541 |
kokoro_interface,
|
|
|
|
|
|
|
| 1542 |
]
|
| 1543 |
_tab_names = [
|
| 1544 |
"Fetch Webpage",
|
| 1545 |
"DuckDuckGo Search",
|
| 1546 |
"Python Code Executor",
|
|
|
|
| 1547 |
"Kokoro TTS",
|
|
|
|
|
|
|
| 1548 |
]
|
| 1549 |
|
| 1550 |
-
# Only expose memory manager if an HF_READ_TOKEN is present (parity with Image/Video gating)
|
| 1551 |
-
HAS_HF_READ = bool(HF_API_TOKEN)
|
| 1552 |
-
if HAS_HF_READ:
|
| 1553 |
-
# Insert before Kokoro TTS for previous ordering
|
| 1554 |
-
insert_index = 3 if len(_interfaces) >= 3 else len(_interfaces)
|
| 1555 |
-
_interfaces.insert(insert_index, memory_interface)
|
| 1556 |
-
_tab_names.insert(insert_index, "Memory Manager")
|
| 1557 |
-
|
| 1558 |
-
if HAS_HF_TOKEN:
|
| 1559 |
-
_interfaces.extend([image_generation_interface, video_generation_interface])
|
| 1560 |
-
_tab_names.extend(["Image Generation", "Video Generation"])
|
| 1561 |
-
|
| 1562 |
demo = gr.TabbedInterface(
|
| 1563 |
interface_list=_interfaces,
|
| 1564 |
tab_names=_tab_names,
|
|
|
|
| 1067 |
}
|
| 1068 |
.gradio-container h1::after {
|
| 1069 |
grid-row: 3;
|
| 1070 |
+
content: "Authentication is optional. Image/Video generation require an HF token to function and may be hidden from MCP tools without one — but UI tabs remain visible. Memory is intended for local use and may be hidden from MCP tools.";
|
| 1071 |
display: block;
|
| 1072 |
font-size: 1rem;
|
| 1073 |
font-weight: 400;
|
|
|
|
| 1214 |
"Use Memory_Manager whenever you are given information worth remembering about the user, and search for memories when relevant."
|
| 1215 |
),
|
| 1216 |
flagging_mode="never",
|
| 1217 |
+
# Always visible in the UI, but only exposed as an MCP tool when HF token is present
|
| 1218 |
+
show_api=bool(os.getenv("HF_READ_TOKEN")),
|
| 1219 |
)
|
| 1220 |
|
| 1221 |
# ==========================
|
|
|
|
| 1341 |
"Returns a PIL.Image. Return the generated media to the user in this format ``"
|
| 1342 |
),
|
| 1343 |
flagging_mode="never",
|
| 1344 |
+
# Only expose to MCP when HF token is provided; UI tab is always visible
|
| 1345 |
+
show_api=bool(os.getenv("HF_READ_TOKEN")),
|
| 1346 |
)
|
| 1347 |
|
| 1348 |
# ==========================
|
|
|
|
| 1533 |
"Return the generated media to the user in this format ``"
|
| 1534 |
),
|
| 1535 |
flagging_mode="never",
|
| 1536 |
+
# Only expose to MCP when HF token is provided; UI tab is always visible
|
| 1537 |
+
show_api=bool(os.getenv("HF_READ_TOKEN") or os.getenv("HF_TOKEN")),
|
| 1538 |
)
|
| 1539 |
|
|
|
|
|
|
|
|
|
|
| 1540 |
_interfaces = [
|
| 1541 |
fetch_interface,
|
| 1542 |
concise_interface,
|
| 1543 |
code_interface,
|
| 1544 |
+
memory_interface, # Always visible in UI
|
| 1545 |
kokoro_interface,
|
| 1546 |
+
image_generation_interface, # Always visible in UI
|
| 1547 |
+
video_generation_interface, # Always visible in UI
|
| 1548 |
]
|
| 1549 |
_tab_names = [
|
| 1550 |
"Fetch Webpage",
|
| 1551 |
"DuckDuckGo Search",
|
| 1552 |
"Python Code Executor",
|
| 1553 |
+
"Memory Manager",
|
| 1554 |
"Kokoro TTS",
|
| 1555 |
+
"Image Generation",
|
| 1556 |
+
"Video Generation",
|
| 1557 |
]
|
| 1558 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1559 |
demo = gr.TabbedInterface(
|
| 1560 |
interface_list=_interfaces,
|
| 1561 |
tab_names=_tab_names,
|