Spaces:
Sleeping
Sleeping
Commit
·
35a3c7f
1
Parent(s):
0ac0451
Layout update
Browse files
app.py
CHANGED
|
@@ -19,8 +19,8 @@ def transliterate(text: str) -> str:
|
|
| 19 |
return output.strip()
|
| 20 |
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
<center><h1>🇰🇿 DalaT5</h1>
|
| 25 |
<h2>Қазақша кириллица → латын графикасының транслитераторы</h2>
|
| 26 |
<h3>Kazakh Cyrillic → Latin Script Transliterator</h3></center>
|
|
@@ -30,16 +30,22 @@ flip_card_html = """
|
|
| 30 |
<div class="flip-card">
|
| 31 |
<div class="flip-card-inner">
|
| 32 |
<div class="flip-card-front">
|
| 33 |
-
<
|
| 34 |
-
<
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
| 37 |
</div>
|
| 38 |
<div class="flip-card-back">
|
| 39 |
-
<
|
| 40 |
-
<
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
</div>
|
| 44 |
</div>
|
| 45 |
</div>
|
|
@@ -56,70 +62,116 @@ flip_card_html = """
|
|
| 56 |
|
| 57 |
<script>
|
| 58 |
document.addEventListener("DOMContentLoaded", function() {
|
|
|
|
|
|
|
| 59 |
const card = document.querySelector(".flip-card");
|
| 60 |
const inner = document.querySelector(".flip-card-inner");
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
inner.classList.toggle("flipped");
|
| 64 |
});
|
| 65 |
});
|
| 66 |
</script>
|
| 67 |
"""
|
| 68 |
|
| 69 |
-
# Custom CSS
|
| 70 |
-
|
| 71 |
.flip-card {
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
.flip-card-inner {
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
.flip-card-inner.flipped {
|
| 91 |
-
|
| 92 |
}
|
| 93 |
|
| 94 |
.flip-card-front, .flip-card-back {
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
.flip-card-back {
|
| 111 |
-
|
| 112 |
}
|
| 113 |
|
| 114 |
a {
|
| 115 |
-
|
| 116 |
-
|
| 117 |
}
|
| 118 |
"""
|
| 119 |
|
| 120 |
# Interface
|
| 121 |
-
with gr.Blocks(css =
|
| 122 |
-
gr.HTML(
|
| 123 |
gr.Markdown("---")
|
| 124 |
gr.Interface(
|
| 125 |
fn = transliterate,
|
|
|
|
| 19 |
return output.strip()
|
| 20 |
|
| 21 |
|
| 22 |
+
# HTML code for the description
|
| 23 |
+
description_html = """
|
| 24 |
<center><h1>🇰🇿 DalaT5</h1>
|
| 25 |
<h2>Қазақша кириллица → латын графикасының транслитераторы</h2>
|
| 26 |
<h3>Kazakh Cyrillic → Latin Script Transliterator</h3></center>
|
|
|
|
| 30 |
<div class="flip-card">
|
| 31 |
<div class="flip-card-inner">
|
| 32 |
<div class="flip-card-front">
|
| 33 |
+
<button class="EN">EN</button>
|
| 34 |
+
<h3>Қазақша (KZ)</h3><br>
|
| 35 |
+
<p>
|
| 36 |
+
<span><strong>DalaT5</strong> - <b>кириллицада</b> жазылған табиғи қазақ тілін еркін <b>латын графикасына</b> ауыстыру үшін дайындалған T5 негізіндегі модель, Қазақстанның 2021 жылғы ресми әліпби реформасына негізделген.</span>
|
| 37 |
+
<br><br>
|
| 38 |
+
<span>Бұл модель құрмет пен қызығушылықтың мәдени қимылы ретінде ұсынылады. Ол қазіргі қазақ тілін бүгінгі адамдар қалай жазады, солай қабылдайды - және оның болашағының тілінде жауап береді.</span>
|
| 39 |
+
</p>
|
| 40 |
</div>
|
| 41 |
<div class="flip-card-back">
|
| 42 |
+
<button class="KZ">KZ</button>
|
| 43 |
+
<h3>English (EN)</h3><br>
|
| 44 |
+
<p>
|
| 45 |
+
<span><strong>DalaT5</strong> is a T5-based model trained to convert natural Kazakh written in <b>Cyrillic</b> into fluent <b>Latin script</b>, based on the official 2021 alphabet reform of Kazakhstan.</span>
|
| 46 |
+
<br><br>
|
| 47 |
+
<span>This model is offered as a cultural gesture of respect and curiosity. It accepts modern Kazakh as people write it today - and answers in the language of its future.</span>
|
| 48 |
+
</p>
|
| 49 |
</div>
|
| 50 |
</div>
|
| 51 |
</div>
|
|
|
|
| 62 |
|
| 63 |
<script>
|
| 64 |
document.addEventListener("DOMContentLoaded", function() {
|
| 65 |
+
const en = document.querySelector(".EN");
|
| 66 |
+
const kz = document.querySelector(".KZ");
|
| 67 |
const card = document.querySelector(".flip-card");
|
| 68 |
const inner = document.querySelector(".flip-card-inner");
|
| 69 |
|
| 70 |
+
en.addEventListener("click", function() {
|
| 71 |
+
inner.classList.toggle("flipped");
|
| 72 |
+
});
|
| 73 |
+
|
| 74 |
+
kz.addEventListener("click", function() {
|
| 75 |
inner.classList.toggle("flipped");
|
| 76 |
});
|
| 77 |
});
|
| 78 |
</script>
|
| 79 |
"""
|
| 80 |
|
| 81 |
+
# Custom CSS
|
| 82 |
+
description_css = """
|
| 83 |
.flip-card {
|
| 84 |
+
position: relative;
|
| 85 |
+
display: flex;
|
| 86 |
+
justify-content: center;
|
| 87 |
+
align-items: center;
|
| 88 |
+
background-color: transparent;
|
| 89 |
+
width: 100%;
|
| 90 |
+
max-width: 900px;
|
| 91 |
+
height: 250px;
|
| 92 |
+
margin: 0 auto 2rem auto;
|
| 93 |
+
overflow: hidden;
|
| 94 |
}
|
| 95 |
|
| 96 |
.flip-card-inner {
|
| 97 |
+
position: relative;
|
| 98 |
+
width: 95%;
|
| 99 |
+
height: 99%;
|
| 100 |
+
transition: transform 0.8s;
|
| 101 |
+
display: flex;
|
| 102 |
+
justify-content: center;
|
| 103 |
+
align-items: center;
|
| 104 |
+
transform-style: preserve-3d;
|
| 105 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 106 |
+
border-radius: 15px;
|
| 107 |
+
z-index: 1;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.flip-card .flip-card-inner .EN,
|
| 111 |
+
.flip-card .flip-card-inner .KZ {
|
| 112 |
+
position: absolute;
|
| 113 |
+
top: 10px;
|
| 114 |
+
right: 10px;
|
| 115 |
+
background: none;
|
| 116 |
+
border: 1px solid white;
|
| 117 |
+
padding: 6px;
|
| 118 |
+
border-radius: 5px;
|
| 119 |
+
font-weight: bold;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
transition: 0.5s;
|
| 122 |
+
z-index: 3;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.flip-card .flip-card-inner .EN:hover,
|
| 126 |
+
.flip-card .flip-card-inner .KZ:hover {
|
| 127 |
+
box-shadow: 5px 5px white;
|
| 128 |
+
top: 13px;
|
| 129 |
+
right: 13px;
|
| 130 |
}
|
| 131 |
|
| 132 |
.flip-card-inner.flipped {
|
| 133 |
+
transform: rotateY(180deg);
|
| 134 |
}
|
| 135 |
|
| 136 |
.flip-card-front, .flip-card-back {
|
| 137 |
+
position: absolute;
|
| 138 |
+
width: 100%;
|
| 139 |
+
height: 100%;
|
| 140 |
+
backface-visibility: hidden;
|
| 141 |
+
background-color: transparent;
|
| 142 |
+
color: inherit;
|
| 143 |
+
font-size: 16px;
|
| 144 |
+
display: flex;
|
| 145 |
+
flex-direction: column;
|
| 146 |
+
justify-content: center;
|
| 147 |
+
align-items: center;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
.flip-card-front p, .flip-card-back p{
|
| 151 |
+
display: flex;
|
| 152 |
+
justify-content: center;
|
| 153 |
+
align-items: center;
|
| 154 |
+
flex-direction: column;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.flip-card-front p span, .flip-card-back p span {
|
| 158 |
+
width: 95%;
|
| 159 |
+
margin: 0 10px;
|
| 160 |
}
|
| 161 |
|
| 162 |
.flip-card-back {
|
| 163 |
+
transform: rotateY(180deg);
|
| 164 |
}
|
| 165 |
|
| 166 |
a {
|
| 167 |
+
color: inherit;
|
| 168 |
+
text-decoration: underline;
|
| 169 |
}
|
| 170 |
"""
|
| 171 |
|
| 172 |
# Interface
|
| 173 |
+
with gr.Blocks(css = description_css) as demo:
|
| 174 |
+
gr.HTML(description_html)
|
| 175 |
gr.Markdown("---")
|
| 176 |
gr.Interface(
|
| 177 |
fn = transliterate,
|