Name: Paar (founder, 16 Nov); repo renamed from mt-draft
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
"""
|
| 2 |
run as CTranslate2 int8 on the Space's CPU, greedy, one sentence at a time, exactly as in the model cards' quick start.
|
| 3 |
The model folders are copies inside this Space, so restarts never fetch from the model repos (no inflated download
|
| 4 |
counts); each run is counted once at mcp.udgamlabs.com/count (model, language, channel, outcome; never the text).
|
|
@@ -18,10 +18,10 @@ import sentencepiece as spm
|
|
| 18 |
from gradio_theme import CSS, HEAD, footer, header, theme
|
| 19 |
|
| 20 |
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 21 |
-
NAME = "
|
| 22 |
COUNT_URL = os.environ.get("UDGAM_COUNT_URL", "https://mcp.udgamlabs.com/count")
|
| 23 |
COUNT_MODEL = os.environ.get("UDGAM_COUNT_MODEL", NAME.lower())
|
| 24 |
-
REPO = os.environ.get("UDGAM_REPO_PREFIX", "udgamlabs/
|
| 25 |
LANGS = {"Hindi": "hi", "Bengali": "bn", "Marathi": "mr", "Telugu": "te", "Tamil": "ta", "Gujarati": "gu",
|
| 26 |
"Urdu": "ur", "Kannada": "kn", "Malayalam": "ml", "Punjabi": "pa", "Odia": "or", "Assamese": "as"}
|
| 27 |
INFO = json.load(open(os.path.join(HERE, "models.json"), encoding="utf-8"))
|
|
@@ -80,7 +80,7 @@ def _channel(request):
|
|
| 80 |
|
| 81 |
def info(lang):
|
| 82 |
m = INFO[LANGS[lang]]
|
| 83 |
-
return (f'<p class="ul-label">
|
| 84 |
f'chrF++ FLORES+ {m["fl"]:.2f} · <a href="https://huggingface.co/{REPO}-{LANGS[lang]}">model card</a></p>')
|
| 85 |
|
| 86 |
|
|
@@ -127,7 +127,7 @@ EXAMPLES = ["The train leaves at 6:45 tomorrow morning, so please be at the stat
|
|
| 127 |
"Can you send me the invoice for the last three months?",
|
| 128 |
"My phone battery dies by the afternoon even though I charge it overnight."]
|
| 129 |
|
| 130 |
-
with gr.Blocks(title=f"
|
| 131 |
gr.HTML(header(NAME, "Translator · English → 12 languages",
|
| 132 |
"Twelve small translation models, 17.3M parameters and 17.7 MB each at int8. They run here on a "
|
| 133 |
"shared CPU, and offline on yours or in your browser: see the model cards for the quick starts."))
|
|
|
|
| 1 |
+
"""Paar demo Space: twelve small English-to-X translators (16 Nov 2026; four on 14 Nov), 17.3M parameters each,
|
| 2 |
run as CTranslate2 int8 on the Space's CPU, greedy, one sentence at a time, exactly as in the model cards' quick start.
|
| 3 |
The model folders are copies inside this Space, so restarts never fetch from the model repos (no inflated download
|
| 4 |
counts); each run is counted once at mcp.udgamlabs.com/count (model, language, channel, outcome; never the text).
|
|
|
|
| 18 |
from gradio_theme import CSS, HEAD, footer, header, theme
|
| 19 |
|
| 20 |
HERE = os.path.dirname(os.path.abspath(__file__))
|
| 21 |
+
NAME = "Paar"
|
| 22 |
COUNT_URL = os.environ.get("UDGAM_COUNT_URL", "https://mcp.udgamlabs.com/count")
|
| 23 |
COUNT_MODEL = os.environ.get("UDGAM_COUNT_MODEL", NAME.lower())
|
| 24 |
+
REPO = os.environ.get("UDGAM_REPO_PREFIX", "udgamlabs/Paar-en")
|
| 25 |
LANGS = {"Hindi": "hi", "Bengali": "bn", "Marathi": "mr", "Telugu": "te", "Tamil": "ta", "Gujarati": "gu",
|
| 26 |
"Urdu": "ur", "Kannada": "kn", "Malayalam": "ml", "Punjabi": "pa", "Odia": "or", "Assamese": "as"}
|
| 27 |
INFO = json.load(open(os.path.join(HERE, "models.json"), encoding="utf-8"))
|
|
|
|
| 80 |
|
| 81 |
def info(lang):
|
| 82 |
m = INFO[LANGS[lang]]
|
| 83 |
+
return (f'<p class="ul-label">Paar English → {lang} · 17.3M parameters · {m["folder"]} MB at int8 · '
|
| 84 |
f'chrF++ FLORES+ {m["fl"]:.2f} · <a href="https://huggingface.co/{REPO}-{LANGS[lang]}">model card</a></p>')
|
| 85 |
|
| 86 |
|
|
|
|
| 127 |
"Can you send me the invoice for the last three months?",
|
| 128 |
"My phone battery dies by the afternoon even though I charge it overnight."]
|
| 129 |
|
| 130 |
+
with gr.Blocks(title=f"Paar · Udgam Labs") as demo:
|
| 131 |
gr.HTML(header(NAME, "Translator · English → 12 languages",
|
| 132 |
"Twelve small translation models, 17.3M parameters and 17.7 MB each at int8. They run here on a "
|
| 133 |
"shared CPU, and offline on yours or in your browser: see the model cards for the quick starts."))
|