Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,10 +41,17 @@ if st.button("Extract Text"):
|
|
| 41 |
complete_text += extract_text_from_docx(uploaded_file)
|
| 42 |
elif uploaded_file.name.endswith('.xlsx'):
|
| 43 |
complete_text += extract_text_from_excel(uploaded_file)
|
| 44 |
-
|
| 45 |
# Display the extracted text
|
| 46 |
st.text_area("Extracted Text", complete_text, height=300)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
else:
|
| 48 |
st.write("Please upload at least one file to extract text.")
|
| 49 |
-
|
| 50 |
-
|
|
|
|
| 41 |
complete_text += extract_text_from_docx(uploaded_file)
|
| 42 |
elif uploaded_file.name.endswith('.xlsx'):
|
| 43 |
complete_text += extract_text_from_excel(uploaded_file)
|
| 44 |
+
|
| 45 |
# Display the extracted text
|
| 46 |
st.text_area("Extracted Text", complete_text, height=300)
|
| 47 |
+
|
| 48 |
+
# Save the extracted text to a local file
|
| 49 |
+
if st.button("Save to Local"):
|
| 50 |
+
with open("extracted_text.txt", "w", encoding="utf-8") as file:
|
| 51 |
+
file.write(complete_text)
|
| 52 |
+
st.success("Text saved locally as `extracted_text.txt`!")
|
| 53 |
+
|
| 54 |
+
# Download the extracted text as a file
|
| 55 |
+
st.download_button("Download as Text File", complete_text, file_name="extracted_text.txt")
|
| 56 |
else:
|
| 57 |
st.write("Please upload at least one file to extract text.")
|
|
|
|
|
|