Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ st.title("SummarizeIt")
|
|
19 |
uploaded_file = st.file_uploader("Choose a file", type=["pdf", "txt", "docx"])
|
20 |
|
21 |
# Text extraction
|
22 |
-
text =
|
23 |
if uploaded_file is not None:
|
24 |
if uploaded_file.type == "application/pdf":
|
25 |
pdf_reader = PyPDF2.PdfReader(uploaded_file)
|
@@ -31,7 +31,7 @@ if uploaded_file is not None:
|
|
31 |
text = docx2txt.process(uploaded_file)
|
32 |
# Text input for direct text entry
|
33 |
user_input = st.text_area("Or paste your text here:")
|
34 |
-
text
|
35 |
|
36 |
def generate_text(model, input_texts, max_length=500, print_time_taken=False):
|
37 |
# Convert input_texts to a list if it's a Dataset
|
|
|
19 |
uploaded_file = st.file_uploader("Choose a file", type=["pdf", "txt", "docx"])
|
20 |
|
21 |
# Text extraction
|
22 |
+
text = []
|
23 |
if uploaded_file is not None:
|
24 |
if uploaded_file.type == "application/pdf":
|
25 |
pdf_reader = PyPDF2.PdfReader(uploaded_file)
|
|
|
31 |
text = docx2txt.process(uploaded_file)
|
32 |
# Text input for direct text entry
|
33 |
user_input = st.text_area("Or paste your text here:")
|
34 |
+
text.append(user_input) if user_input else text.append(text) # Prioritize user input over file
|
35 |
|
36 |
def generate_text(model, input_texts, max_length=500, print_time_taken=False):
|
37 |
# Convert input_texts to a list if it's a Dataset
|