amine_dubs commited on
Commit
110d39e
·
1 Parent(s): 54fb2f1
Files changed (2) hide show
  1. backend/main.py +1 -5
  2. static/script.js +4 -4
backend/main.py CHANGED
@@ -182,11 +182,7 @@ def translate_text(text, source_lang, target_lang):
182
  return use_fallback_translation(text, source_lang, target_lang)
183
 
184
  try:
185
- # Get full language name for better cultural adaptation
186
- source_lang_name = LANGUAGE_MAP.get(source_lang, source_lang)
187
-
188
- # The Helsinki model doesn't need or work with the elaborate prompt
189
- # Just send the text directly for translation
190
  text_to_translate = text
191
 
192
  # Use a more reliable timeout approach with concurrent.futures
 
182
  return use_fallback_translation(text, source_lang, target_lang)
183
 
184
  try:
185
+ # Only send the raw text to the Helsinki model
 
 
 
 
186
  text_to_translate = text
187
 
188
  # Use a more reliable timeout approach with concurrent.futures
static/script.js CHANGED
@@ -20,10 +20,10 @@ window.onload = function() {
20
  if (el) el.style.display = 'none';
21
  });
22
 
23
- // Get form elements directly from the form itself
24
- const textInput = textTranslationForm.querySelector('#text-input');
25
- const sourceLang = textTranslationForm.querySelector('#source-lang-text');
26
- const targetLang = textTranslationForm.querySelector('#target-lang-text');
27
  const loadingElement = document.querySelector('#text-loading');
28
  const debugElement = document.querySelector('#debug-info');
29
 
 
20
  if (el) el.style.display = 'none';
21
  });
22
 
23
+ // Always select elements from the form context
24
+ const textInput = this.querySelector('#text-input');
25
+ const sourceLang = this.querySelector('#source-lang-text');
26
+ const targetLang = this.querySelector('#target-lang-text');
27
  const loadingElement = document.querySelector('#text-loading');
28
  const debugElement = document.querySelector('#debug-info');
29