amine_dubs commited on
Commit
b7f5097
·
1 Parent(s): 110d39e
Files changed (2) hide show
  1. backend/requirements.txt +7 -6
  2. static/script.js +17 -1
backend/requirements.txt CHANGED
@@ -1,13 +1,14 @@
1
  fastapi
2
- uvicorn
 
 
 
 
 
3
  python-docx
4
  PyMuPDF
5
- requests
6
- python-multipart
7
  jinja2
8
- transformers
9
- torch
10
  sentencepiece
11
  tensorflow
12
- googletrans==4.0.0-rc1
13
  accelerate
 
1
  fastapi
2
+ uvicorn[standard]
3
+ python-multipart
4
+ requests
5
+ transformers[torch]
6
+ torch
7
+ googletrans==4.0.0-rc1
8
  python-docx
9
  PyMuPDF
10
+ sacremoses # Added for MarianMT tokenization
 
11
  jinja2
 
 
12
  sentencepiece
13
  tensorflow
 
14
  accelerate
static/script.js CHANGED
@@ -20,10 +20,20 @@ window.onload = function() {
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
 
@@ -45,7 +55,13 @@ window.onload = function() {
45
 
46
  // Check for missing elements
47
  if (!textInput || !sourceLang || !targetLang) {
48
- showError('Form elements not found. Please check the HTML structure.');
 
 
 
 
 
 
49
  return;
50
  }
51
 
 
20
  if (el) el.style.display = 'none';
21
  });
22
 
23
+ // Debugging: Log the form element itself
24
+ console.log('Form element context (this):', this);
25
+
26
  // Always select elements from the form context
27
  const textInput = this.querySelector('#text-input');
28
+ // Debugging: Log the result of the querySelector
29
+ console.log('Result of this.querySelector(\'#text-input\'):', textInput);
30
+
31
  const sourceLang = this.querySelector('#source-lang-text');
32
+ console.log('Result of this.querySelector(\'#source-lang-text\'):', sourceLang);
33
+
34
  const targetLang = this.querySelector('#target-lang-text');
35
+ console.log('Result of this.querySelector(\'#target-lang-text\'):', targetLang);
36
+
37
  const loadingElement = document.querySelector('#text-loading');
38
  const debugElement = document.querySelector('#debug-info');
39
 
 
55
 
56
  // Check for missing elements
57
  if (!textInput || !sourceLang || !targetLang) {
58
+ // Debugging: Log which specific elements are missing
59
+ console.error('Missing elements:', {
60
+ textInput: textInput,
61
+ sourceLang: sourceLang,
62
+ targetLang: targetLang
63
+ });
64
+ showError('Form elements not found. Please check the HTML structure and console logs.');
65
  return;
66
  }
67