cstr commited on
Commit
6b5534c
·
verified ·
1 Parent(s): 103c5f2

Update translator.py

Browse files
Files changed (1) hide show
  1. translator.py +8 -0
translator.py CHANGED
@@ -1127,6 +1127,7 @@ class UltimateDocumentTranslator:
1127
  self.ct2 and self.ct2.available,
1128
  self.opus and self.opus.available,
1129
  self.madlad and self.madlad.available,
 
1130
  self.llm and self.llm.providers
1131
  ])
1132
 
@@ -1180,6 +1181,13 @@ class UltimateDocumentTranslator:
1180
  """Routes text through the active neural engine chain."""
1181
  if not text.strip(): return text
1182
 
 
 
 
 
 
 
 
1183
  # 1. Try NLLB (Local CT2)
1184
  if self.nllb and self.nllb.available:
1185
  result = self.nllb.translate_batch([text])[0]
 
1127
  self.ct2 and self.ct2.available,
1128
  self.opus and self.opus.available,
1129
  self.madlad and self.madlad.available,
1130
+ self.sauerkraut and self.sauerkraut.available,
1131
  self.llm and self.llm.providers
1132
  ])
1133
 
 
1181
  """Routes text through the active neural engine chain."""
1182
  if not text.strip(): return text
1183
 
1184
+ # 0. Try Sauerkraut API (High Priority if selected)
1185
+ if hasattr(self, 'sauerkraut') and self.sauerkraut and self.sauerkraut.available:
1186
+ # Sauerkraut is synchronous, but we can run it in this async wrapper
1187
+ result = self.sauerkraut.translate_batch([text])[0]
1188
+ if result and result.strip() != text.strip():
1189
+ return result
1190
+
1191
  # 1. Try NLLB (Local CT2)
1192
  if self.nllb and self.nllb.available:
1193
  result = self.nllb.translate_batch([text])[0]