Spaces:
Running
Running
File size: 3,550 Bytes
0bc2c6b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | /**
* Single source of shared config for every MesmerTools HuggingFace Space.
* Authored once here and imported by all spaces so nothing is duplicated.
*
* Data that changes often (TTS voices, benchmark runs) is NOT hardcoded — it is
* fetched at runtime from generated JSON on mesmer.tools (see DATA) so the spaces
* always reflect the canonical constants in the main repo.
*/
export const SITE = {
name: "MesmerTools",
origin: "https://mesmer.tools",
cdn: "https://cdn.mesmer.tools",
tagline: "Free developer & AI tools.",
};
/**
* Per-endpoint contract.
* `freeLimitPerHour` is the per-IP free cap the API enforces (null = no hard
* hourly cap). Because each space calls the API directly from the visitor's
* browser, this limit is per-user — every HuggingFace visitor gets their own
* bucket. On a 429 the space points users at `fullToolPath` for higher limits.
*/
export const ENDPOINTS = {
screenshot: {
apiPath: "/api/v1/screenshot",
method: "GET",
freeLimitPerHour: 10,
fullToolPath: "/api-tools/screenshot",
},
siteLogo: {
apiPath: "/api/v1/site-logo",
method: "GET",
freeLimitPerHour: null, // cached server-side; no hard hourly cap
fullToolPath: "/api-tools/site-logo",
},
tts: {
apiPath: "/api/v1/tts",
method: "POST",
freeLimitPerHour: 20,
fullToolPath: "/api-tools/tts",
},
logo: {
trpcPath: "/api/trpc/logo.generate",
method: "POST",
freeLimitPerHour: 10,
fullToolPath: "/free-tools/ai-logo-maker",
},
benchmark: {
fullToolPath: "/benchmarks/ai-video-generation",
},
};
/**
* Live data endpoints. These serve JSON straight from the canonical constants
* in the main repo (no generated snapshot, no build step) so the spaces always
* reflect the current voices / benchmark dict. Edge-cached for an hour.
*/
export const DATA = {
ttsVoices: `${SITE.origin}/api/v1/tts/voices`,
videoBenchmark: `${SITE.origin}/api/v1/benchmarks/ai-video-generation`,
};
/**
* Cross-sell catalog shown in the footer strip of every space. These are the
* SEO backlinks to mesmer.tools. `key` matches ENDPOINTS keys so a space can
* exclude itself from its own strip.
*/
export const TOOL_CATALOG = [
{ key: "logo", emoji: "🎨", name: "AI Logo Maker", desc: "Generate a brand logo from a prompt.", path: "/free-tools/ai-logo-maker" },
{ key: "tts", emoji: "🔊", name: "Text to Speech", desc: "Natural AI voices, free.", path: "/api-tools/tts" },
{ key: "screenshot", emoji: "📸", name: "Screenshot API", desc: "Capture any URL as an image.", path: "/api-tools/screenshot" },
{ key: "siteLogo", emoji: "🏷️", name: "Site Logo / Favicon", desc: "Fetch any website's logo.", path: "/api-tools/site-logo" },
{ key: "music", emoji: "🎵", name: "AI Music Maker", desc: "Generate short music clips.", path: "/free-tools/ai-music-maker" },
{ key: "tokens", emoji: "🧮", name: "Token Price Calculator", desc: "Estimate LLM API costs.", path: "/free-tools/token-price-calculator" },
{ key: "json", emoji: "{ }", name: "JSON Formatter", desc: "Format & validate JSON.", path: "/free-tools/json-formatter" },
{ key: "synthid", emoji: "🔍", name: "Detect SynthID", desc: "Check images for AI watermarks.", path: "/free-tools/detect-synthid" },
{ key: "benchmark", emoji: "🏁", name: "AI Video Benchmark", desc: "Which LLM codes the best video?", path: "/benchmarks/ai-video-generation" },
];
/** Absolute mesmer.tools URL for a path. */
export function siteUrl(path) {
return `${SITE.origin}${path}`;
}
|