Update app.py
Browse files
app.py
CHANGED
@@ -66,14 +66,15 @@ should_we_translate = gr.Interface(
|
|
66 |
# Function to read text from a Word document
|
67 |
def read_word_document(uploaded_file):
|
68 |
if uploaded_file is not None:
|
69 |
-
# The file content is in uploaded_file[
|
70 |
-
file_stream = io.BytesIO(uploaded_file[
|
71 |
document = Document(file_stream)
|
72 |
text = '\n'.join([para.text for para in document.paragraphs])
|
73 |
return text
|
74 |
return "Please upload a Word document."
|
75 |
|
76 |
|
|
|
77 |
# Gradio interface for reading Word document
|
78 |
read_docx = gr.Interface(
|
79 |
read_word_document,
|
|
|
66 |
# Function to read text from a Word document
|
67 |
def read_word_document(uploaded_file):
|
68 |
if uploaded_file is not None:
|
69 |
+
# The file content is in uploaded_file[1], which is bytes
|
70 |
+
file_stream = io.BytesIO(uploaded_file[1])
|
71 |
document = Document(file_stream)
|
72 |
text = '\n'.join([para.text for para in document.paragraphs])
|
73 |
return text
|
74 |
return "Please upload a Word document."
|
75 |
|
76 |
|
77 |
+
|
78 |
# Gradio interface for reading Word document
|
79 |
read_docx = gr.Interface(
|
80 |
read_word_document,
|