Commit
·
7fb0621
1
Parent(s):
9895ac6
add banner
Browse files- gradio_mcp_space.py +53 -0
gradio_mcp_space.py
CHANGED
|
@@ -2535,6 +2535,58 @@ def get_concept_overview(concept: str, limit: int = 15) -> str:
|
|
| 2535 |
except Exception as e:
|
| 2536 |
return f"Error: {str(e)}"
|
| 2537 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2538 |
|
| 2539 |
# ==================== Gradio App ====================
|
| 2540 |
|
|
@@ -2542,6 +2594,7 @@ def create_gradio_app():
|
|
| 2542 |
"""Create and configure the Gradio interface."""
|
| 2543 |
|
| 2544 |
with gr.Blocks(title="Code Knowledge Graph Explorer — 🤗 Transformers Library — Knowledge Graph MCP Server", theme=gr.themes.Soft()) as demo:
|
|
|
|
| 2545 |
# Helper to render tool docstrings in the UI
|
| 2546 |
def _tool_doc_md(func):
|
| 2547 |
doc = (func.__doc__ or "No description available.").strip()
|
|
|
|
| 2535 |
except Exception as e:
|
| 2536 |
return f"Error: {str(e)}"
|
| 2537 |
|
| 2538 |
+
|
| 2539 |
+
def _get_header_explorer():
|
| 2540 |
+
html = """
|
| 2541 |
+
<style>
|
| 2542 |
+
.kge-header-container {
|
| 2543 |
+
background: linear-gradient(314deg, #64748b 0%, #373f4a 100%);
|
| 2544 |
+
padding: 28px 22px;
|
| 2545 |
+
border-radius: 16px;
|
| 2546 |
+
color: white !important;
|
| 2547 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
| 2548 |
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 2549 |
+
margin-bottom: 25px;
|
| 2550 |
+
font-family: 'Inter', -apple-system, sans-serif;
|
| 2551 |
+
text-align: center;
|
| 2552 |
+
}
|
| 2553 |
+
|
| 2554 |
+
.kge-header-title {
|
| 2555 |
+
font-size: 30px;
|
| 2556 |
+
font-weight: 700;
|
| 2557 |
+
margin-bottom: 8px;
|
| 2558 |
+
}
|
| 2559 |
+
|
| 2560 |
+
.kge-header-subtitle {
|
| 2561 |
+
font-size: 17px;
|
| 2562 |
+
font-weight: 400;
|
| 2563 |
+
margin-bottom: 6px;
|
| 2564 |
+
}
|
| 2565 |
+
|
| 2566 |
+
.kge-header-link a {
|
| 2567 |
+
color: #d7e8ff;
|
| 2568 |
+
font-weight: 600;
|
| 2569 |
+
text-decoration: none;
|
| 2570 |
+
}
|
| 2571 |
+
|
| 2572 |
+
.kge-header-link a:hover {
|
| 2573 |
+
text-decoration: underline;
|
| 2574 |
+
}
|
| 2575 |
+
</style>
|
| 2576 |
+
|
| 2577 |
+
<div class="kge-header-container">
|
| 2578 |
+
<div class="kge-header-title">Transformers Knowledge Graph Explorer</div>
|
| 2579 |
+
<div class="kge-header-subtitle">
|
| 2580 |
+
Explore, query, and understand the structure of the Hugging Face Transformers codebase.
|
| 2581 |
+
</div>
|
| 2582 |
+
<div class="kge-header-link">
|
| 2583 |
+
<a href="https://www.epita.fr/" target="_blank">EPITA Website</a>
|
| 2584 |
+
</div>
|
| 2585 |
+
</div>
|
| 2586 |
+
"""
|
| 2587 |
+
return html
|
| 2588 |
+
|
| 2589 |
+
|
| 2590 |
|
| 2591 |
# ==================== Gradio App ====================
|
| 2592 |
|
|
|
|
| 2594 |
"""Create and configure the Gradio interface."""
|
| 2595 |
|
| 2596 |
with gr.Blocks(title="Code Knowledge Graph Explorer — 🤗 Transformers Library — Knowledge Graph MCP Server", theme=gr.themes.Soft()) as demo:
|
| 2597 |
+
gr.HTML(_get_header_explorer())
|
| 2598 |
# Helper to render tool docstrings in the UI
|
| 2599 |
def _tool_doc_md(func):
|
| 2600 |
doc = (func.__doc__ or "No description available.").strip()
|