Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import openpyxl
|
|
|
|
| 4 |
import docx
|
| 5 |
from io import BytesIO
|
| 6 |
from reportlab.pdfgen import canvas
|
|
@@ -67,24 +68,20 @@ if API_KEY:
|
|
| 67 |
c.save()
|
| 68 |
return output
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
st.title("π
|
| 72 |
st.write("Upload, edit, and manage `.docx`, `.xls` files with AI-powered NLP and full Excel tools.")
|
| 73 |
|
| 74 |
# π€ File Uploaders
|
| 75 |
-
uploaded_files = [
|
| 76 |
-
file_types = ["docx", "xls", "docx", "xls"]
|
| 77 |
-
|
| 78 |
-
for i in range(4):
|
| 79 |
-
uploaded_files[i] = st.file_uploader(f"π Upload File {i+1} ({file_types[i]})", type=[file_types[i]])
|
| 80 |
|
| 81 |
# βοΈ File Editors
|
| 82 |
edited_docs = {}
|
| 83 |
edited_excels = {}
|
| 84 |
|
| 85 |
-
for
|
| 86 |
if file:
|
| 87 |
-
st.subheader(f"π Editing File
|
| 88 |
|
| 89 |
if file.name.endswith(".docx"):
|
| 90 |
text = load_docx(file)
|
|
@@ -97,7 +94,7 @@ if API_KEY:
|
|
| 97 |
|
| 98 |
edited_docs[file.name] = edited_text
|
| 99 |
|
| 100 |
-
elif file.name.endswith(".xls"):
|
| 101 |
xls = load_excel(file)
|
| 102 |
sheet_name = st.selectbox(f"π Select Sheet in {file.name}:", xls.sheet_names)
|
| 103 |
df = pd.read_excel(xls, sheet_name=sheet_name)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import openpyxl
|
| 4 |
+
import xlrd
|
| 5 |
import docx
|
| 6 |
from io import BytesIO
|
| 7 |
from reportlab.pdfgen import canvas
|
|
|
|
| 68 |
c.save()
|
| 69 |
return output
|
| 70 |
|
| 71 |
+
# **π AI-Powered File Manager UI**
|
| 72 |
+
st.title("π AI-Powered File Manager with NLP & Excel Editor")
|
| 73 |
st.write("Upload, edit, and manage `.docx`, `.xls` files with AI-powered NLP and full Excel tools.")
|
| 74 |
|
| 75 |
# π€ File Uploaders
|
| 76 |
+
uploaded_files = st.file_uploader("π Upload `.docx` or `.xlsx` Files", type=["docx", "xls", "xlsx"], accept_multiple_files=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
# βοΈ File Editors
|
| 79 |
edited_docs = {}
|
| 80 |
edited_excels = {}
|
| 81 |
|
| 82 |
+
for file in uploaded_files:
|
| 83 |
if file:
|
| 84 |
+
st.subheader(f"π Editing File: {file.name}")
|
| 85 |
|
| 86 |
if file.name.endswith(".docx"):
|
| 87 |
text = load_docx(file)
|
|
|
|
| 94 |
|
| 95 |
edited_docs[file.name] = edited_text
|
| 96 |
|
| 97 |
+
elif file.name.endswith(".xls") or file.name.endswith(".xlsx"):
|
| 98 |
xls = load_excel(file)
|
| 99 |
sheet_name = st.selectbox(f"π Select Sheet in {file.name}:", xls.sheet_names)
|
| 100 |
df = pd.read_excel(xls, sheet_name=sheet_name)
|