Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,6 +38,8 @@ class Language(str, Enum):
|
|
| 38 |
WOLOF = "Wolof"
|
| 39 |
HAUSA = "Hausa"
|
| 40 |
DARIJA = "Darija"
|
|
|
|
|
|
|
| 41 |
|
| 42 |
class InputMode(str, Enum):
|
| 43 |
"""Supported input modes."""
|
|
@@ -67,7 +69,19 @@ TRANSLATION_MODELS: Dict[Tuple[Language, Language], ModelConfig] = {
|
|
| 67 |
),
|
| 68 |
(Language.ENGLISH, Language.DARIJA): ModelConfig(
|
| 69 |
"LocaleNLP/english_darija", ">>dar<<"
|
| 70 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
# File type support
|
|
@@ -132,7 +146,7 @@ class ModelManager:
|
|
| 132 |
logger.info(f"Loading translation model: {config.model_name}")
|
| 133 |
|
| 134 |
# Authenticate with Hugging Face if token provided
|
| 135 |
-
if hf_token := os.getenv("
|
| 136 |
login(token=hf_token)
|
| 137 |
|
| 138 |
model = AutoModelForSeq2SeqLM.from_pretrained(
|
|
@@ -476,7 +490,7 @@ class TranslationApp:
|
|
| 476 |
# Header
|
| 477 |
gr.Markdown("""
|
| 478 |
# 🌍 LocaleNLP Translation Service
|
| 479 |
-
Translate between English, Wolof, Hausa, and Darija with support for text, audio, and documents.
|
| 480 |
""")
|
| 481 |
|
| 482 |
# Input controls
|
|
|
|
| 38 |
WOLOF = "Wolof"
|
| 39 |
HAUSA = "Hausa"
|
| 40 |
DARIJA = "Darija"
|
| 41 |
+
SWAHILI = "Swahili"
|
| 42 |
+
BAMBARA = "Bambara"
|
| 43 |
|
| 44 |
class InputMode(str, Enum):
|
| 45 |
"""Supported input modes."""
|
|
|
|
| 69 |
),
|
| 70 |
(Language.ENGLISH, Language.DARIJA): ModelConfig(
|
| 71 |
"LocaleNLP/english_darija", ">>dar<<"
|
| 72 |
+
),
|
| 73 |
+
(Language.ENGLISH, Language.BAMBARA): ModelConfig(
|
| 74 |
+
"LocaleNLP/localenlp-eng-bam-0.03", ">>bam<<"
|
| 75 |
+
),
|
| 76 |
+
(Language.BAMBARA, Language.ENGLISH): ModelConfig(
|
| 77 |
+
"LocaleNLP/localenlp-bam-eng-0.03", ">>eng<<"
|
| 78 |
+
),
|
| 79 |
+
(Language.SWAHILI, Language.ENGLISH): ModelConfig(
|
| 80 |
+
"LocaleNLP/localenlp-swa-eng-0.03", ">>eng<<"
|
| 81 |
+
),
|
| 82 |
+
(Language.ENGLISH, Language.SWAHILI): ModelConfig(
|
| 83 |
+
"LocaleNLP/localenlp-eng-swa-0.03", ">>swa<<"
|
| 84 |
+
),
|
| 85 |
}
|
| 86 |
|
| 87 |
# File type support
|
|
|
|
| 146 |
logger.info(f"Loading translation model: {config.model_name}")
|
| 147 |
|
| 148 |
# Authenticate with Hugging Face if token provided
|
| 149 |
+
if hf_token := os.getenv("final_tk"):
|
| 150 |
login(token=hf_token)
|
| 151 |
|
| 152 |
model = AutoModelForSeq2SeqLM.from_pretrained(
|
|
|
|
| 490 |
# Header
|
| 491 |
gr.Markdown("""
|
| 492 |
# 🌍 LocaleNLP Translation Service
|
| 493 |
+
Translate between English, Wolof, Hausa,Bambara, Swahili and Darija with support for text, audio, and documents.
|
| 494 |
""")
|
| 495 |
|
| 496 |
# Input controls
|