Spaces:
Running
Running
David Pomerenke
commited on
Commit
·
678e066
1
Parent(s):
f0b789d
Routing and clipboard link
Browse files
app.py
CHANGED
|
@@ -568,6 +568,41 @@ css="""
|
|
| 568 |
display: grid !important;
|
| 569 |
grid-template-columns: 1fr 1fr;
|
| 570 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 571 |
"""
|
| 572 |
|
| 573 |
|
|
@@ -580,10 +615,10 @@ if (lang) {
|
|
| 580 |
console.log("redirecting to " + lang);
|
| 581 |
window.location.href = "/" + lang;
|
| 582 |
}
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
"
|
| 586 |
-
}
|
| 587 |
</script>
|
| 588 |
"""
|
| 589 |
|
|
@@ -761,9 +796,18 @@ with gr.Blocks(title="AI Language Proficiency Benchmark", css=css, head=shortcut
|
|
| 761 |
)
|
| 762 |
|
| 763 |
|
| 764 |
-
for lang in tqdm(languages[:
|
| 765 |
with demo.route(lang['language_name'], f"/{lang['bcp_47']}"):
|
| 766 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 767 |
|
| 768 |
|
| 769 |
demo.launch()
|
|
|
|
| 568 |
display: grid !important;
|
| 569 |
grid-template-columns: 1fr 1fr;
|
| 570 |
}
|
| 571 |
+
|
| 572 |
+
.nav-holder {display: none;}
|
| 573 |
+
|
| 574 |
+
.share-link {
|
| 575 |
+
display: inline-flex;
|
| 576 |
+
align-items: center;
|
| 577 |
+
background-color: #f0f0f0;
|
| 578 |
+
border-radius: 8px;
|
| 579 |
+
padding: 8px 12px;
|
| 580 |
+
margin: 10px 0;
|
| 581 |
+
font-family: monospace;
|
| 582 |
+
transition: all 0.2s ease;
|
| 583 |
+
cursor: pointer;
|
| 584 |
+
text-decoration: none;
|
| 585 |
+
color: #333;
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
.share-link:hover {
|
| 589 |
+
background-color: #e0e0e0;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
.share-link .icon {
|
| 593 |
+
margin-left: 8px;
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
.title-row {
|
| 597 |
+
display: flex;
|
| 598 |
+
align-items: center;
|
| 599 |
+
justify-content: space-between;
|
| 600 |
+
margin-bottom: 1rem;
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
.title-row h2 {
|
| 604 |
+
margin: 0;
|
| 605 |
+
}
|
| 606 |
"""
|
| 607 |
|
| 608 |
|
|
|
|
| 615 |
console.log("redirecting to " + lang);
|
| 616 |
window.location.href = "/" + lang;
|
| 617 |
}
|
| 618 |
+
const copyLinkToClipboard = (link) => {
|
| 619 |
+
navigator.clipboard.writeText(link);
|
| 620 |
+
console.log("Copied link to clipboard: " + link);
|
| 621 |
+
}
|
| 622 |
</script>
|
| 623 |
"""
|
| 624 |
|
|
|
|
| 796 |
)
|
| 797 |
|
| 798 |
|
| 799 |
+
for lang in tqdm(languages[:20], desc="Generating pages"):
|
| 800 |
with demo.route(lang['language_name'], f"/{lang['bcp_47']}"):
|
| 801 |
+
url = f"hf.co/spaces/datenlaborbmz/ai-language-monitor?lang={lang['bcp_47']}"
|
| 802 |
+
gr.Markdown(
|
| 803 |
+
f'''
|
| 804 |
+
<div class="title-row">
|
| 805 |
+
<h2>{lang['language_name']}</h2>
|
| 806 |
+
<div class="share-link" onclick="copyLinkToClipboard('{url}')">{url}<span class="icon">📋</span></div>
|
| 807 |
+
</div>
|
| 808 |
+
''',
|
| 809 |
+
sanitize_html=False
|
| 810 |
+
)
|
| 811 |
|
| 812 |
|
| 813 |
demo.launch()
|