André Oliveira
commited on
Commit
·
c813369
1
Parent(s):
27cfb20
added custom theme
Browse files- app.py +25 -7
- claude_theme.py +87 -0
app.py
CHANGED
|
@@ -136,7 +136,8 @@ DEFAULT_AUTOTUNE_JSON = model_to_json(AutotuneRequest)
|
|
| 136 |
DEFAULT_QA_JSON = model_to_json(QARequest)
|
| 137 |
|
| 138 |
|
| 139 |
-
|
|
|
|
| 140 |
gr.Markdown("# 🧠 Ragmint MCP Server")
|
| 141 |
|
| 142 |
gr.HTML("""
|
|
@@ -159,6 +160,23 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 159 |
</div>
|
| 160 |
""")
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
gr.Markdown("""
|
| 163 |
**AI-Powered Optimization for RAG Pipelines**
|
| 164 |
|
|
@@ -228,7 +246,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 228 |
gr.Markdown("📄 Upload files (local paths or URLs) to your `data/docs` folder.")
|
| 229 |
upload_files = gr.File(file_count="multiple", type="filepath")
|
| 230 |
upload_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path")
|
| 231 |
-
upload_btn = gr.Button("Upload", variant="
|
| 232 |
upload_out = gr.JSON(label="Response")
|
| 233 |
upload_btn.click(upload_docs_tool, inputs=[upload_files, upload_path], outputs=upload_out)
|
| 234 |
|
|
@@ -255,7 +273,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 255 |
return upload_docs_tool(urls, docs_path)
|
| 256 |
|
| 257 |
upload_mcp_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path")
|
| 258 |
-
upload_mcp_btn = gr.Button("Upload", variant="
|
| 259 |
upload_mcp_out = gr.JSON(label="Response")
|
| 260 |
|
| 261 |
upload_mcp_btn.click(
|
|
@@ -313,7 +331,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 313 |
label="LLM Model"
|
| 314 |
)
|
| 315 |
|
| 316 |
-
autotune_btn = gr.Button("Autotune", variant="
|
| 317 |
autotune_out = gr.Textbox(label="Response", lines=15)
|
| 318 |
|
| 319 |
|
|
@@ -423,7 +441,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 423 |
label="LLM Model"
|
| 424 |
)
|
| 425 |
|
| 426 |
-
optimize_btn = gr.Button("Optimize", variant="
|
| 427 |
optimize_out = gr.Textbox(label="Response", lines=15)
|
| 428 |
|
| 429 |
|
|
@@ -485,7 +503,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 485 |
min_q = gr.Slider(1, 20, step=1, value=3, label="Min Questions")
|
| 486 |
max_q = gr.Slider(1, 50, step=1, value=25, label="Max Questions")
|
| 487 |
|
| 488 |
-
qa_btn = gr.Button("Generate QA", variant="
|
| 489 |
qa_out = gr.Textbox(lines=15, label="Response")
|
| 490 |
|
| 491 |
|
|
@@ -518,7 +536,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 518 |
gr.Markdown("## Clear Cache")
|
| 519 |
gr.Markdown("🗑️ Deletes all files and directories inside docs_path on the server.")
|
| 520 |
clear_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path to Clear")
|
| 521 |
-
clear_btn = gr.Button("Clear Cache", variant="
|
| 522 |
clear_out = gr.JSON(label="Response")
|
| 523 |
clear_btn.click(clear_cache_tool, inputs=[clear_path], outputs=clear_out)
|
| 524 |
gr.Markdown("---")
|
|
|
|
| 136 |
DEFAULT_QA_JSON = model_to_json(QARequest)
|
| 137 |
|
| 138 |
|
| 139 |
+
from claude_theme import Claude
|
| 140 |
+
with gr.Blocks(theme=Claude()) as demo:
|
| 141 |
gr.Markdown("# 🧠 Ragmint MCP Server")
|
| 142 |
|
| 143 |
gr.HTML("""
|
|
|
|
| 160 |
</div>
|
| 161 |
""")
|
| 162 |
|
| 163 |
+
gr.HTML("""
|
| 164 |
+
<style>
|
| 165 |
+
.center-wrapper {
|
| 166 |
+
display: flex;
|
| 167 |
+
justify-content: center;
|
| 168 |
+
align-items: center;
|
| 169 |
+
}
|
| 170 |
+
.center-wrapper img {
|
| 171 |
+
height: 100px !important;
|
| 172 |
+
}
|
| 173 |
+
</style>
|
| 174 |
+
|
| 175 |
+
<div class="center-wrapper">
|
| 176 |
+
<img src="https://raw.githubusercontent.com/andyolivers/ragmint/main/src/ragmint/assets/img/ragmint_logo.png" alt="Ragmint Banner">
|
| 177 |
+
</div>
|
| 178 |
+
""")
|
| 179 |
+
|
| 180 |
gr.Markdown("""
|
| 181 |
**AI-Powered Optimization for RAG Pipelines**
|
| 182 |
|
|
|
|
| 246 |
gr.Markdown("📄 Upload files (local paths or URLs) to your `data/docs` folder.")
|
| 247 |
upload_files = gr.File(file_count="multiple", type="filepath")
|
| 248 |
upload_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path")
|
| 249 |
+
upload_btn = gr.Button("Upload", variant="primary")
|
| 250 |
upload_out = gr.JSON(label="Response")
|
| 251 |
upload_btn.click(upload_docs_tool, inputs=[upload_files, upload_path], outputs=upload_out)
|
| 252 |
|
|
|
|
| 273 |
return upload_docs_tool(urls, docs_path)
|
| 274 |
|
| 275 |
upload_mcp_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path")
|
| 276 |
+
upload_mcp_btn = gr.Button("Upload", variant="primary")
|
| 277 |
upload_mcp_out = gr.JSON(label="Response")
|
| 278 |
|
| 279 |
upload_mcp_btn.click(
|
|
|
|
| 331 |
label="LLM Model"
|
| 332 |
)
|
| 333 |
|
| 334 |
+
autotune_btn = gr.Button("Autotune", variant="primary")
|
| 335 |
autotune_out = gr.Textbox(label="Response", lines=15)
|
| 336 |
|
| 337 |
|
|
|
|
| 441 |
label="LLM Model"
|
| 442 |
)
|
| 443 |
|
| 444 |
+
optimize_btn = gr.Button("Optimize", variant="primary")
|
| 445 |
optimize_out = gr.Textbox(label="Response", lines=15)
|
| 446 |
|
| 447 |
|
|
|
|
| 503 |
min_q = gr.Slider(1, 20, step=1, value=3, label="Min Questions")
|
| 504 |
max_q = gr.Slider(1, 50, step=1, value=25, label="Max Questions")
|
| 505 |
|
| 506 |
+
qa_btn = gr.Button("Generate QA", variant="primary")
|
| 507 |
qa_out = gr.Textbox(lines=15, label="Response")
|
| 508 |
|
| 509 |
|
|
|
|
| 536 |
gr.Markdown("## Clear Cache")
|
| 537 |
gr.Markdown("🗑️ Deletes all files and directories inside docs_path on the server.")
|
| 538 |
clear_path = gr.Textbox(value=DEFAULT_UPLOAD_PATH, label="Docs Path to Clear")
|
| 539 |
+
clear_btn = gr.Button("Clear Cache", variant="primary")
|
| 540 |
clear_out = gr.JSON(label="Response")
|
| 541 |
clear_btn.click(clear_cache_tool, inputs=[clear_path], outputs=clear_out)
|
| 542 |
gr.Markdown("---")
|
claude_theme.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
from collections.abc import Iterable
|
| 3 |
+
from gradio.themes.base import Base
|
| 4 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 5 |
+
|
| 6 |
+
custom_primary = colors.Color(
|
| 7 |
+
c50="#FCE8E0",
|
| 8 |
+
c100="#F9D0C1",
|
| 9 |
+
c200="#F5B8A3",
|
| 10 |
+
c300="#F0A184",
|
| 11 |
+
c400="#EB8965",
|
| 12 |
+
c500="#E65F2B",
|
| 13 |
+
c600="#C94F24",
|
| 14 |
+
c700="#A03F1D",
|
| 15 |
+
c800="#782F16",
|
| 16 |
+
c900="#4F1F0F",
|
| 17 |
+
c950="#2A1208",
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
class Claude(Base):
|
| 21 |
+
def __init__(
|
| 22 |
+
self,
|
| 23 |
+
*,
|
| 24 |
+
primary_hue=custom_primary,
|
| 25 |
+
secondary_hue=colors.amber,
|
| 26 |
+
neutral_hue=colors.zinc,
|
| 27 |
+
spacing_size=sizes.spacing_md,
|
| 28 |
+
radius_size=sizes.radius_xxl,
|
| 29 |
+
text_size=sizes.text_md,
|
| 30 |
+
font=(
|
| 31 |
+
fonts.GoogleFont("Inter"),
|
| 32 |
+
"ui-sans-serif",
|
| 33 |
+
"system-ui",
|
| 34 |
+
"sans-serif",
|
| 35 |
+
),
|
| 36 |
+
font_mono=(
|
| 37 |
+
fonts.GoogleFont("IBM Plex Mono"),
|
| 38 |
+
"ui-monospace",
|
| 39 |
+
"Consolas",
|
| 40 |
+
"monospace",
|
| 41 |
+
),
|
| 42 |
+
):
|
| 43 |
+
super().__init__(
|
| 44 |
+
primary_hue=primary_hue,
|
| 45 |
+
secondary_hue=secondary_hue,
|
| 46 |
+
neutral_hue=neutral_hue,
|
| 47 |
+
spacing_size=spacing_size,
|
| 48 |
+
radius_size=radius_size,
|
| 49 |
+
text_size=text_size,
|
| 50 |
+
font=font,
|
| 51 |
+
font_mono=font_mono,
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
self.name = "claude"
|
| 55 |
+
|
| 56 |
+
super().set(
|
| 57 |
+
# Global background
|
| 58 |
+
body_background_fill="#F8F5F2",
|
| 59 |
+
block_background_fill="#FFFFFF",
|
| 60 |
+
block_border_width="0px",
|
| 61 |
+
block_shadow="none",
|
| 62 |
+
block_title_text_color="black",
|
| 63 |
+
block_label_border_width="0px",
|
| 64 |
+
|
| 65 |
+
# Inputs
|
| 66 |
+
input_background_fill="white",
|
| 67 |
+
input_border_color="#D8D6D2",
|
| 68 |
+
input_border_width="1px",
|
| 69 |
+
input_shadow="none",
|
| 70 |
+
input_shadow_focus="0 0 0 2px rgba(230,95,43,0.25)",
|
| 71 |
+
|
| 72 |
+
# Buttons
|
| 73 |
+
button_border_width="0px",
|
| 74 |
+
button_transform_hover="scale(1.02)",
|
| 75 |
+
button_transition="all 0.15s ease-in-out",
|
| 76 |
+
|
| 77 |
+
# Primary button (Claude orange)
|
| 78 |
+
button_primary_background_fill="#E65F2B",
|
| 79 |
+
button_primary_background_fill_hover="#D75423",
|
| 80 |
+
button_primary_text_color="white",
|
| 81 |
+
|
| 82 |
+
# Secondary (light minimal)
|
| 83 |
+
button_secondary_background_fill="#EFECEA",
|
| 84 |
+
button_secondary_background_fill_hover="#E8E6E4",
|
| 85 |
+
button_secondary_text_color="#2A2A2A",
|
| 86 |
+
|
| 87 |
+
)
|