amine_dubs
commited on
Commit
·
110d39e
1
Parent(s):
54fb2f1
translate
Browse files- backend/main.py +1 -5
- 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 |
-
#
|
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 |
-
//
|
24 |
-
const textInput =
|
25 |
-
const sourceLang =
|
26 |
-
const targetLang =
|
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 |
|