Spaces:
Paused
Paused
update favicon
Browse files- app.py +34 -1
- index.html +6 -0
app.py
CHANGED
|
@@ -23,9 +23,10 @@ os.environ["WANDB_SILENT"] = "True"
|
|
| 23 |
os.environ["WEAVE_SILENT"] = "True"
|
| 24 |
|
| 25 |
from fastapi import FastAPI, Request
|
| 26 |
-
from fastapi.responses import HTMLResponse, JSONResponse
|
| 27 |
from fastapi.middleware.cors import CORSMiddleware
|
| 28 |
from mcp.server.fastmcp import FastMCP
|
|
|
|
| 29 |
|
| 30 |
# Import W&B setup functions
|
| 31 |
from wandb_mcp_server.server import (
|
|
@@ -52,6 +53,14 @@ INDEX_HTML_PATH = Path(__file__).parent / "index.html"
|
|
| 52 |
with open(INDEX_HTML_PATH, "r") as f:
|
| 53 |
INDEX_HTML_CONTENT = f.read()
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# Initialize W&B
|
| 56 |
logger.info("Initializing W&B configuration...")
|
| 57 |
configure_wandb_logging()
|
|
@@ -120,6 +129,30 @@ async def index():
|
|
| 120 |
"""Serve the landing page."""
|
| 121 |
return INDEX_HTML_CONTENT
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
# Removed OAuth endpoints - only API key authentication is supported
|
| 124 |
# See AUTH_README.md for details on why full OAuth isn't feasible
|
| 125 |
|
|
|
|
| 23 |
os.environ["WEAVE_SILENT"] = "True"
|
| 24 |
|
| 25 |
from fastapi import FastAPI, Request
|
| 26 |
+
from fastapi.responses import HTMLResponse, JSONResponse, Response
|
| 27 |
from fastapi.middleware.cors import CORSMiddleware
|
| 28 |
from mcp.server.fastmcp import FastMCP
|
| 29 |
+
import base64
|
| 30 |
|
| 31 |
# Import W&B setup functions
|
| 32 |
from wandb_mcp_server.server import (
|
|
|
|
| 53 |
with open(INDEX_HTML_PATH, "r") as f:
|
| 54 |
INDEX_HTML_CONTENT = f.read()
|
| 55 |
|
| 56 |
+
# W&B Logo Favicon - Exact copy from wandb.ai/site
|
| 57 |
+
# This is the official favicon PNG (32x32) used on https://wandb.ai
|
| 58 |
+
# Downloaded from: https://cdn.wandb.ai/production/ff061fe17/favicon.png
|
| 59 |
+
WANDB_FAVICON_BASE64 = """iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAUVBMVEUAAAD/zzD/zzD/zzD/zjH/yzD/zDP/zDP/zTL/zDP/zTL/yzL/yzL/zDL/zDL/zDP/zDP/zDP/zDP/yzL/yzP/zDL/zDL/zDL/zDL/zDP/zDNs+ITNAAAAGnRSTlMAECAwP0BQX2BvcICPkJ+gr7C/wM/Q3+Dv8ORN9PUAAAEOSURBVBgZfcEJkpswAADBEVphB0EwzmJg/v/QcKbKC3E3FI/xN5fa8VEAjRq5ENUGaNXIhai2QBrsOJTf3yWHziHxw6AvPpl04pOsmXehfvksOYTAoXz6qgONi8hJdNEwuMicZBcvXGVOsit6FxWboq4LNpWLntLZFNj0+s0mTM5KSLmpAjtn7ELV5MQPnXZ8VJacxFvgUrhFZnc1cCGod6BTE7t7Xd/YJbUDKjWw6Zw92AS1AsK9SWyiq4JNau6BN8lV4n+Sq8Sb8PXri93gbOBNGtUnm6Kbpq7gUDDrXFRc6B0TuMqcJbWFyUXmLKoNtC4SmzyOmUMztAUUf9TMbtKRk8g/gw58UvZ9yZu/MeoYEFwSwuAAAAAASUVORK5CYII=""".strip()
|
| 60 |
+
|
| 61 |
+
# Use the official favicon directly
|
| 62 |
+
FAVICON_BASE64 = WANDB_FAVICON_BASE64
|
| 63 |
+
|
| 64 |
# Initialize W&B
|
| 65 |
logger.info("Initializing W&B configuration...")
|
| 66 |
configure_wandb_logging()
|
|
|
|
| 129 |
"""Serve the landing page."""
|
| 130 |
return INDEX_HTML_CONTENT
|
| 131 |
|
| 132 |
+
@app.get("/favicon.ico")
|
| 133 |
+
async def favicon():
|
| 134 |
+
"""Serve the official W&B logo favicon (exact copy from wandb.ai)."""
|
| 135 |
+
return Response(
|
| 136 |
+
content=base64.b64decode(FAVICON_BASE64),
|
| 137 |
+
media_type="image/png",
|
| 138 |
+
headers={
|
| 139 |
+
"Cache-Control": "public, max-age=31536000", # Cache for 1 year
|
| 140 |
+
"Content-Type": "image/png" # Correct content type for PNG
|
| 141 |
+
}
|
| 142 |
+
)
|
| 143 |
+
|
| 144 |
+
@app.get("/favicon.png")
|
| 145 |
+
async def favicon_png():
|
| 146 |
+
"""Alternative PNG favicon endpoint for better browser compatibility."""
|
| 147 |
+
return Response(
|
| 148 |
+
content=base64.b64decode(FAVICON_BASE64),
|
| 149 |
+
media_type="image/png",
|
| 150 |
+
headers={
|
| 151 |
+
"Cache-Control": "public, max-age=31536000",
|
| 152 |
+
"Content-Type": "image/png"
|
| 153 |
+
}
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
# Removed OAuth endpoints - only API key authentication is supported
|
| 157 |
# See AUTH_README.md for details on why full OAuth isn't feasible
|
| 158 |
|
index.html
CHANGED
|
@@ -4,6 +4,12 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Weights & Biases MCP Server</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Weights & Biases MCP Server</title>
|
| 7 |
+
<!-- Favicon with multiple formats for better browser compatibility -->
|
| 8 |
+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png">
|
| 9 |
+
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
| 10 |
+
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
| 11 |
+
<link rel="apple-touch-icon" sizes="32x32" href="/favicon.png">
|
| 12 |
+
<meta name="msapplication-TileImage" content="/favicon.png">
|
| 13 |
<style>
|
| 14 |
body {
|
| 15 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
|