auth is now optional, but required for Image/Video gen. those tools are hidden otherwise
Browse files
app.py
CHANGED
@@ -628,18 +628,34 @@ code_interface = gr.Interface(
|
|
628 |
CSS_STYLES = """
|
629 |
.gradio-container h1 {
|
630 |
text-align: center;
|
|
|
|
|
|
|
631 |
}
|
632 |
-
/*
|
633 |
-
.gradio-container h1::
|
634 |
-
|
|
|
635 |
display: block;
|
636 |
font-size: 1rem;
|
637 |
-
font-weight:
|
638 |
opacity: 0.9;
|
639 |
margin-top: 6px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
640 |
}
|
641 |
|
642 |
-
/*
|
|
|
643 |
.gradio-container [role=\"tabpanel\"] h1::after {
|
644 |
content: none !important;
|
645 |
}
|
@@ -969,24 +985,29 @@ video_generation_interface = gr.Interface(
|
|
969 |
allow_flagging="never",
|
970 |
)
|
971 |
|
972 |
-
# Build tabbed app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
973 |
demo = gr.TabbedInterface(
|
974 |
-
interface_list=
|
975 |
-
|
976 |
-
concise_interface,
|
977 |
-
code_interface,
|
978 |
-
kokoro_interface,
|
979 |
-
image_generation_interface,
|
980 |
-
video_generation_interface,
|
981 |
-
],
|
982 |
-
tab_names=[
|
983 |
-
"Fetch Webpage",
|
984 |
-
"DuckDuckGo Search",
|
985 |
-
"Python Code Executor",
|
986 |
-
"Kokoro TTS",
|
987 |
-
"Image Generation",
|
988 |
-
"Video Generation",
|
989 |
-
],
|
990 |
title="Tools MCP",
|
991 |
theme="Nymbo/Nymbo_Theme",
|
992 |
css=CSS_STYLES,
|
|
|
628 |
CSS_STYLES = """
|
629 |
.gradio-container h1 {
|
630 |
text-align: center;
|
631 |
+
/* Ensure main title appears first, then our two subtitle lines */
|
632 |
+
display: grid;
|
633 |
+
justify-items: center;
|
634 |
}
|
635 |
+
/* Place bold tools list on line 2, normal auth note on line 3 (below title) */
|
636 |
+
.gradio-container h1::before {
|
637 |
+
grid-row: 2;
|
638 |
+
content: "Fetch Webpage | Search DuckDuckGo | Code Interpreter | Kokoro TTS | Image Generation | Video Generation";
|
639 |
display: block;
|
640 |
font-size: 1rem;
|
641 |
+
font-weight: 700;
|
642 |
opacity: 0.9;
|
643 |
margin-top: 6px;
|
644 |
+
white-space: pre-wrap;
|
645 |
+
}
|
646 |
+
.gradio-container h1::after {
|
647 |
+
grid-row: 3;
|
648 |
+
content: "Authentication is optional but Image/Video Generation require a `HF_READ_TOKEN` in env variables. They are hidden otherwise.";
|
649 |
+
display: block;
|
650 |
+
font-size: 1rem;
|
651 |
+
font-weight: 400;
|
652 |
+
opacity: 0.9;
|
653 |
+
margin-top: 2px;
|
654 |
+
white-space: pre-wrap;
|
655 |
}
|
656 |
|
657 |
+
/* Remove inside tab panels so it doesn't duplicate under each tool title */
|
658 |
+
.gradio-container [role=\"tabpanel\"] h1::before,
|
659 |
.gradio-container [role=\"tabpanel\"] h1::after {
|
660 |
content: none !important;
|
661 |
}
|
|
|
985 |
allow_flagging="never",
|
986 |
)
|
987 |
|
988 |
+
# Build tabbed app; disable Image/Video tools if no HF token is present
|
989 |
+
HAS_HF_TOKEN = bool(HF_API_TOKEN or HF_VIDEO_TOKEN)
|
990 |
+
|
991 |
+
_interfaces = [
|
992 |
+
fetch_interface,
|
993 |
+
concise_interface,
|
994 |
+
code_interface,
|
995 |
+
kokoro_interface,
|
996 |
+
]
|
997 |
+
_tab_names = [
|
998 |
+
"Fetch Webpage",
|
999 |
+
"DuckDuckGo Search",
|
1000 |
+
"Python Code Executor",
|
1001 |
+
"Kokoro TTS",
|
1002 |
+
]
|
1003 |
+
|
1004 |
+
if HAS_HF_TOKEN:
|
1005 |
+
_interfaces.extend([image_generation_interface, video_generation_interface])
|
1006 |
+
_tab_names.extend(["Image Generation", "Video Generation"])
|
1007 |
+
|
1008 |
demo = gr.TabbedInterface(
|
1009 |
+
interface_list=_interfaces,
|
1010 |
+
tab_names=_tab_names,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1011 |
title="Tools MCP",
|
1012 |
theme="Nymbo/Nymbo_Theme",
|
1013 |
css=CSS_STYLES,
|