fadliaulawi commited on
Commit
e6af8fc
·
1 Parent(s): 3cc4808

Update req

Browse files
Files changed (2) hide show
  1. app.py +12 -9
  2. requirements.txt +8 -1
app.py CHANGED
@@ -88,13 +88,6 @@ def process_async(file_name, file_content):
88
  for document in result:
89
  return document.status == 'Succeeded', downloaded_file_content
90
 
91
- def read_word_file(file):
92
- doc = Document(file)
93
- full_text = []
94
- for para in doc.paragraphs:
95
- full_text.append(para.text)
96
- return '\n'.join(full_text)
97
-
98
  if uploaded_files:
99
  submit = st.button("Get Result", key='submit')
100
 
@@ -119,7 +112,7 @@ if uploaded_files and submit:
119
  result, response = process_async(file_name, file_content)
120
 
121
  # Calculate duration
122
- duration = time.time() - start_time
123
 
124
  # Check if translation was successful
125
  if result:
@@ -134,12 +127,22 @@ if uploaded_files and submit:
134
  col1, col2 = st.columns(2)
135
  with col1:
136
  st.write(f"Original File: {uploaded_file.name}")
 
137
  pdf_viewer(file_content)
138
  with col2:
139
  st.write(f"Translated File: {lang_name}-translated-{uploaded_file.name}")
 
140
  pdf_viewer(response)
141
  elif file_type == 'docx':
142
- pass
 
 
 
 
 
 
 
 
143
  elif file_type == 'txt':
144
  # Display the original and translated files side by side
145
  col1, col2 = st.columns(2)
 
88
  for document in result:
89
  return document.status == 'Succeeded', downloaded_file_content
90
 
 
 
 
 
 
 
 
91
  if uploaded_files:
92
  submit = st.button("Get Result", key='submit')
93
 
 
112
  result, response = process_async(file_name, file_content)
113
 
114
  # Calculate duration
115
+ duration = time.time() - start_time
116
 
117
  # Check if translation was successful
118
  if result:
 
127
  col1, col2 = st.columns(2)
128
  with col1:
129
  st.write(f"Original File: {uploaded_file.name}")
130
+ st.divider()
131
  pdf_viewer(file_content)
132
  with col2:
133
  st.write(f"Translated File: {lang_name}-translated-{uploaded_file.name}")
134
+ st.divider()
135
  pdf_viewer(response)
136
  elif file_type == 'docx':
137
+ col1, col2 = st.columns(2)
138
+ with col1:
139
+ st.write(f"Original File: {uploaded_file.name}")
140
+ st.divider()
141
+ st.write("On development")
142
+ with col2:
143
+ st.write(f"Translated File: {lang_name}-translated-{uploaded_file.name}")
144
+ st.divider()
145
+ st.write("On development")
146
  elif file_type == 'txt':
147
  # Display the original and translated files side by side
148
  col1, col2 = st.columns(2)
requirements.txt CHANGED
@@ -1,5 +1,6 @@
1
  altair==5.5.0
2
- attrs==24.2.0
 
3
  azure-ai-translation-document==1.1.0
4
  azure-core==1.32.0
5
  azure-storage-blob==12.24.0
@@ -7,9 +8,11 @@ blinker==1.9.0
7
  cachetools==5.5.0
8
  certifi==2024.8.30
9
  cffi==1.17.1
 
10
  charset-normalizer==3.4.0
11
  click==8.1.7
12
  cryptography==44.0.0
 
13
  gitdb==4.0.11
14
  GitPython==3.1.43
15
  idna==3.10
@@ -25,17 +28,20 @@ narwhals==1.16.0
25
  numpy==2.2.0
26
  packaging==24.2
27
  pandas==2.2.3
 
28
  pillow==11.0.0
29
  protobuf==5.29.1
30
  pyarrow==18.1.0
31
  pycparser==2.22
32
  pydeck==0.9.1
33
  Pygments==2.18.0
 
34
  python-dateutil==2.9.0.post0
35
  python-docx==1.1.2
36
  python-dotenv==1.0.1
37
  pytz==2024.2
38
  referencing==0.35.1
 
39
  requests==2.32.3
40
  rich==13.9.4
41
  rpds-py==0.22.3
@@ -46,6 +52,7 @@ streamlit-pdf-viewer==0.0.19
46
  tenacity==9.0.0
47
  toml==0.10.2
48
  tornado==6.4.2
 
49
  typing_extensions==4.12.2
50
  tzdata==2024.2
51
  urllib3==2.2.3
 
1
  altair==5.5.0
2
+ appscript==1.3.0
3
+ attrs==18.2.0
4
  azure-ai-translation-document==1.1.0
5
  azure-core==1.32.0
6
  azure-storage-blob==12.24.0
 
8
  cachetools==5.5.0
9
  certifi==2024.8.30
10
  cffi==1.17.1
11
+ chardet==5.2.0
12
  charset-normalizer==3.4.0
13
  click==8.1.7
14
  cryptography==44.0.0
15
+ docx2pdf==0.1.8
16
  gitdb==4.0.11
17
  GitPython==3.1.43
18
  idna==3.10
 
28
  numpy==2.2.0
29
  packaging==24.2
30
  pandas==2.2.3
31
+ pdflatex==0.1.3
32
  pillow==11.0.0
33
  protobuf==5.29.1
34
  pyarrow==18.1.0
35
  pycparser==2.22
36
  pydeck==0.9.1
37
  Pygments==2.18.0
38
+ pypandoc==1.14
39
  python-dateutil==2.9.0.post0
40
  python-docx==1.1.2
41
  python-dotenv==1.0.1
42
  pytz==2024.2
43
  referencing==0.35.1
44
+ reportlab==4.2.5
45
  requests==2.32.3
46
  rich==13.9.4
47
  rpds-py==0.22.3
 
52
  tenacity==9.0.0
53
  toml==0.10.2
54
  tornado==6.4.2
55
+ tqdm==4.67.1
56
  typing_extensions==4.12.2
57
  tzdata==2024.2
58
  urllib3==2.2.3