import gradio as gr
from transformers import pipeline
# Load model once
model = pipeline("text2text-generation", model = "crossroderick/dalat5")
def transliterate(text: str) -> str:
"""
Prediction function.
"""
if text.strip() == "":
return ""
input_text = f"Cyrillic2Latin: {text.strip()}"
output = model(input_text, max_length = 128, do_sample = False)[0]["generated_text"]
return output.strip()
# HTML code for the description
description_html = """
Қазақша (KZ)
DalaT5 - кириллицада жазылған табиғи қазақ тілін еркін латын графикасына ауыстыру үшін дайындалған T5 негізіндегі модель, Қазақстанның 2021 жылғы ресми әліпби реформасына негізделген. Бұл модель құрмет пен қызығушылықтың мәдени қимылы ретінде ұсынылады. Ол қазіргі қазақ тілін бүгінгі адамдар қалай жазады, солай қабылдайды - және оның болашағының тілінде жауап береді.
English (EN)
DalaT5 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. 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.
Егер сіз үлес қосқыңыз, бірлесіп жұмыс жасағыңыз немесе жай ғана пікір бөліскіңіз келсе – байланысыңыз / If you'd like to contribute, collaborate, or just share feedback – feel free to connect with Rodrigo Pereira Cruz. 🇧🇷🇰🇿