Update app.py
Browse files
app.py
CHANGED
|
@@ -85,6 +85,8 @@ def create_translated_doc(translated_blocks, output_path):
|
|
| 85 |
st.title("Professional Multilingual PDF Translator")
|
| 86 |
uploaded_file = st.file_uploader("Upload a PDF document for structured translation", type=["pdf"])
|
| 87 |
|
|
|
|
|
|
|
| 88 |
if uploaded_file is not None:
|
| 89 |
with st.spinner("Processing and translating the document..."):
|
| 90 |
temp_file_path = "uploaded_document.pdf"
|
|
@@ -98,8 +100,7 @@ if uploaded_file is not None:
|
|
| 98 |
# Translate content
|
| 99 |
translated_blocks = translate_content(content_blocks)
|
| 100 |
|
| 101 |
-
#
|
| 102 |
-
output_docx_path = "translated_document.docx"
|
| 103 |
create_translated_doc(translated_blocks, output_docx_path)
|
| 104 |
|
| 105 |
# Provide download link for the translated document
|
|
|
|
| 85 |
st.title("Professional Multilingual PDF Translator")
|
| 86 |
uploaded_file = st.file_uploader("Upload a PDF document for structured translation", type=["pdf"])
|
| 87 |
|
| 88 |
+
output_docx_path = "translated_document.docx" # Ensure the variable is defined outside any block
|
| 89 |
+
|
| 90 |
if uploaded_file is not None:
|
| 91 |
with st.spinner("Processing and translating the document..."):
|
| 92 |
temp_file_path = "uploaded_document.pdf"
|
|
|
|
| 100 |
# Translate content
|
| 101 |
translated_blocks = translate_content(content_blocks)
|
| 102 |
|
| 103 |
+
# Create translated DOCX
|
|
|
|
| 104 |
create_translated_doc(translated_blocks, output_docx_path)
|
| 105 |
|
| 106 |
# Provide download link for the translated document
|