crossroderick commited on
Commit
62d7088
·
1 Parent(s): 4c2c509

Major layout update

Browse files
Files changed (1) hide show
  1. app.py +105 -22
app.py CHANGED
@@ -19,6 +19,92 @@ def transliterate(text: str) -> str:
19
  return output.strip()
20
 
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # App description (Markdown style)
23
  description = """
24
  ### Қазақша кириллица → латын графикасының транслитераторы / Kazakh Cyrillic → Latin Script Transliterator
@@ -48,28 +134,25 @@ DalaT5 - **кириллицада** жазылған табиғи қазақ т
48
  """
49
 
50
  # Interface
51
- demo = gr.Interface(
52
- fn = transliterate,
53
- inputs = gr.Textbox(
54
- label = "Қазақ тілінде теріңіз (кириллица) / Type in Kazakh (Cyrillic script)",
55
- placeholder = "Мен қазақ тілінде сөйлеймін.",
56
- lines = 6
57
- ),
58
-
59
- outputs = gr.Textbox(
60
- label = "Латын графикасының шығуы / Latin script output"
61
- ),
62
-
63
- title = "🇰🇿 DalaT5",
64
- description = description,
65
- theme = "default",
66
- flagging_mode = "never",
67
- css = """
68
- footer {visibility: hidden;}
69
- .gradio-container {padding: 1.5rem}
70
- .input_text, .output_text {font-size: 1.1rem}
71
- """
72
- )
73
 
74
 
75
  if __name__ == "__main__":
 
19
  return output.strip()
20
 
21
 
22
+ # Custom HTML for flip card
23
+ flip_card_html = """
24
+ <h3>Қазақша кириллица → латын графикасының транслитераторы / Kazakh Cyrillic → Latin Script Transliterator</h3>
25
+
26
+ <hr>
27
+ <br><br>
28
+
29
+ <div class="flip-card">
30
+ <div class="flip-card-inner">
31
+ <div class="flip-card-front">
32
+ <h3>Қазақша (KZ)</h3>
33
+ <p><strong>DalaT5</strong> - **кириллицада** жазылған табиғи қазақ тілін еркін **латын графикасына** ауыстыру үшін дайындалған T5 негізіндегі модель, Қазақстанның 2021 жылғы ресми әліпби реформасына негізделген.<br><br>
34
+
35
+ Бұл модель құрмет пен қызығушылықтың мәдени қимылы ретінде ұсынылады. Ол қазіргі қазақ тілін бүгінгі адамдар қалай жазады, солай қабылдайды - және оның болашағының тілінде жауап береді.</p>
36
+ </div>
37
+ <div class="flip-card-back">
38
+ <h3>English (EN)</h3>
39
+ <p><strong>DalaT5</strong> is a T5-based model trained to convert natural Kazakh written in **Cyrillic** into fluent **Latin script**, based on the official 2021 alphabet reform of Kazakhstan.<br><br>
40
+
41
+ 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>
42
+ </div>
43
+ </div>
44
+ </div>
45
+
46
+ <br>
47
+
48
+ <div style="text-align: center; font-size: 1rem;">
49
+ <p>🧠 <a href="https://huggingface.co/crossroderick/dalat5" target="_blank">Model page</a><br>
50
+ 🔤 <a href="https://astanatimes.com/2021/02/kazakhstan-presents-new-latin-alphabet-plans-gradual-transition-through-2031/" target="_blank">Kazakhstan 2021 alphabet reform</a></p>
51
+
52
+ <br>
53
+
54
+ <p>Егер сіз үлес қосқыңыз, бірлесіп жұмыс жасағыңыз немесе жай ғана пікір бөліскіңіз келсе – байланысыңыз / If you'd like to contribute, collaborate, or just share feedback – feel free to connect with <a href="https://www.linkedin.com/in/rpereiracruz/" target="_blank">Rodrigo Pereira Cruz</a>. 🇧🇷🇰🇿</p>
55
+ </div>
56
+ """
57
+
58
+ # Custom CSS for flip card
59
+ flip_card_css = """
60
+ .flip-card {
61
+ background-color: transparent;
62
+ width: 100%;
63
+ max-width: 450px;
64
+ height: 250px;
65
+ perspective: 1000px;
66
+ margin: 0 auto 2rem auto;
67
+ }
68
+
69
+ .flip-card-inner {
70
+ position: relative;
71
+ width: 100%;
72
+ height: 100%;
73
+ text-align: center;
74
+ transition: transform 0.8s;
75
+ transform-style: preserve-3d;
76
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
77
+ border-radius: 15px;
78
+ }
79
+
80
+ .flip-card:hover .flip-card-inner {
81
+ transform: rotateY(180deg);
82
+ }
83
+
84
+ .flip-card-front, .flip-card-back {
85
+ position: absolute;
86
+ width: 100%;
87
+ height: 100%;
88
+ backface-visibility: hidden;
89
+ background-color: #fefefe;
90
+ border-radius: 15px;
91
+ padding: 20px;
92
+ display: flex;
93
+ flex-direction: column;
94
+ justify-content: center;
95
+ }
96
+
97
+ .flip-card-front {
98
+ background-color: #f0f8ff;
99
+ }
100
+
101
+ .flip-card-back {
102
+ background-color: #e6f7ff;
103
+ transform: rotateY(180deg);
104
+ }
105
+ """
106
+
107
+
108
  # App description (Markdown style)
109
  description = """
110
  ### Қазақша кириллица → латын графикасының транслитераторы / Kazakh Cyrillic → Latin Script Transliterator
 
134
  """
135
 
136
  # Interface
137
+ with gr.Blocks(css = flip_card_css) as demo:
138
+ gr.HTML(flip_card_html)
139
+ gr.Markdown("---")
140
+ gr.Interface(
141
+ fn=transliterate,
142
+ inputs=gr.Textbox(
143
+ label = "Қазақ тілінде теріңіз (кириллица) / Type in Kazakh (Cyrillic script)",
144
+ placeholder = "Мен қазақ тілінде сөйлеймін.",
145
+ lines = 6
146
+ ),
147
+ outputs = gr.Textbox(
148
+ label = "Латын графикасының шығуы / Latin script output",
149
+ ),
150
+
151
+ title = "🇰🇿 DalaT5",
152
+ description = description,
153
+ theme = "default",
154
+ flagging_mode = "never"
155
+ ).render()
 
 
 
156
 
157
 
158
  if __name__ == "__main__":