| <script> | |
| function onDOMContentLoaded() { | |
| document.removeEventListener("DOMContentLoaded", onDOMContentLoaded); | |
| var currentUrl = window.location.href; | |
| var regex = /https:\/\/([\w]+)-([\w-]+)\.static\.hf\.space/; | |
| var match = currentUrl.match(regex); | |
| if (match) { | |
| var repo = match[1]; | |
| var space = match[2]; | |
| var targetUrl = "https://huggingface.co/spaces/" + repo + "/" + space; | |
| console.log("Redirecting to:", targetUrl); | |
| window.location.href = targetUrl; | |
| } else { | |
| console.error("URL pattern does not match."); | |
| } | |
| } | |
| document.addEventListener("DOMContentLoaded", onDOMContentLoaded); | |
| </script> | |