Update app.py
Browse files
app.py
CHANGED
|
@@ -113,6 +113,34 @@ caption.caption {
|
|
| 113 |
cursor: text;
|
| 114 |
}
|
| 115 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
with gr.Blocks(css=custom_css) as demo:
|
| 117 |
gr.Markdown(
|
| 118 |
"""
|
|
@@ -135,7 +163,8 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 135 |
|
| 136 |
search_face_button.click(search_face, inputs=[image, token], outputs=[output], api_name=False)
|
| 137 |
|
| 138 |
-
gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online"><img src="https://api.visitorbadge.io/api/
|
| 139 |
-
|
|
|
|
| 140 |
|
| 141 |
demo.queue(api_open=False, default_concurrency_limit=4).launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|
|
|
|
| 113 |
cursor: text;
|
| 114 |
}
|
| 115 |
"""
|
| 116 |
+
|
| 117 |
+
js = """
|
| 118 |
+
function aff() {
|
| 119 |
+
const links = document.querySelectorAll('a');
|
| 120 |
+
|
| 121 |
+
const currentUrl = new URL(window.location.href);
|
| 122 |
+
const currentParams = currentUrl.searchParams.toString();
|
| 123 |
+
|
| 124 |
+
links.forEach(link => {
|
| 125 |
+
const href = link.getAttribute('href');
|
| 126 |
+
if (href && (href.startsWith('https://faceonlive.pocketsflow.com') || href.startsWith('https://faceonlive.com'))) {
|
| 127 |
+
const targetUrl = new URL(href);
|
| 128 |
+
// Append current page parameters to the link
|
| 129 |
+
currentParams.split('&').forEach(param => {
|
| 130 |
+
if (param) {
|
| 131 |
+
const [key, value] = param.split('=');
|
| 132 |
+
targetUrl.searchParams.set(key, value);
|
| 133 |
+
}
|
| 134 |
+
});
|
| 135 |
+
link.setAttribute('href', targetUrl.toString());
|
| 136 |
+
console.log(`Updated Link: ${targetUrl.toString()}`);
|
| 137 |
+
}
|
| 138 |
+
});
|
| 139 |
+
|
| 140 |
+
return ''
|
| 141 |
+
}
|
| 142 |
+
"""
|
| 143 |
+
|
| 144 |
with gr.Blocks(css=custom_css) as demo:
|
| 145 |
gr.Markdown(
|
| 146 |
"""
|
|
|
|
| 163 |
|
| 164 |
search_face_button.click(search_face, inputs=[image, token], outputs=[output], api_name=False)
|
| 165 |
|
| 166 |
+
gr.HTML('<a href="https://visitorbadge.io/status?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online"><img src="https://api.visitorbadge.io/api/combined?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2FFaceOnLive%2FFace-Search-Online&labelColor=%23ff8a65&countColor=%2337d67a&style=flat&labelStyle=upper" /></a>')
|
| 167 |
+
html = gr.HTML()
|
| 168 |
+
demo.load(None, inputs=None, outputs=html, js=js)
|
| 169 |
|
| 170 |
demo.queue(api_open=False, default_concurrency_limit=4).launch(server_name="0.0.0.0", server_port=7860, show_api=False)
|