crossroderick commited on
Commit
35a3c7f
·
1 Parent(s): 0ac0451

Layout update

Browse files
Files changed (1) hide show
  1. app.py +97 -45
app.py CHANGED
@@ -19,8 +19,8 @@ def transliterate(text: str) -> str:
19
  return output.strip()
20
 
21
 
22
- # Custom HTML for flip card
23
- flip_card_html = """
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
- <center><h3>Қазақша (KZ)</h3></center><br>
34
- <p><strong>DalaT5</strong> - <b>кириллицада</b> жазылған табиғи қазақ тілін еркін <b>латын графикасына</b> ауыстыру үшін дайындалған T5 негізіндегі модель, Қазақстанның 2021 жылғы ресми әліпби реформасына негізделген.<br><br>
35
-
36
- Бұл модель құрмет пен қызығушылықтың мәдени қимылы ретінде ұсынылады. Ол қазіргі қазақ тілін бүгінгі адамдар қалай жазады, солай қабылдайды - және оның болашағының тілінде жауап береді.</p>
 
 
 
37
  </div>
38
  <div class="flip-card-back">
39
- <center><h3>English (EN)</h3></center><br>
40
- <p><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.<br><br>
41
-
42
- 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.</p>
 
 
 
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
- card.addEventListener("click", function() {
 
 
 
 
63
  inner.classList.toggle("flipped");
64
  });
65
  });
66
  </script>
67
  """
68
 
69
- # Custom CSS for flip card
70
- flip_card_css = """
71
  .flip-card {
72
- background-color: transparent;
73
- width: 100%;
74
- max-width: 900px;
75
- height: 250px;
76
- perspective: 1000px;
77
- margin: 0 auto 2rem auto;
78
- cursor: pointer;
 
 
 
79
  }
80
 
81
  .flip-card-inner {
82
- position: relative;
83
- width: 100%;
84
- height: 100%;
85
- transition: transform 0.8s;
86
- transform-style: preserve-3d;
87
- border-radius: 15px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  .flip-card-inner.flipped {
91
- transform: rotateY(180deg);
92
  }
93
 
94
  .flip-card-front, .flip-card-back {
95
- position: absolute;
96
- width: 100%;
97
- height: 100%;
98
- backface-visibility: hidden;
99
- background-color: transparent;
100
- color: inherit;
101
- border: 1px solid rgba(255, 255, 255, 0.2);
102
- border-radius: 15px;
103
- font-size: 16px;
104
- padding: 20px;
105
- display: flex;
106
- flex-direction: column;
107
- justify-content: center;
 
 
 
 
 
 
 
 
 
 
108
  }
109
 
110
  .flip-card-back {
111
- transform: rotateY(180deg);
112
  }
113
 
114
  a {
115
- color: inherit;
116
- text-decoration: underline;
117
  }
118
  """
119
 
120
  # Interface
121
- with gr.Blocks(css = flip_card_css) as demo:
122
- gr.HTML(flip_card_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,