EmreYY20 commited on
Commit
2a61e91
1 Parent(s): f497f7f
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -30,22 +30,23 @@ def main():
30
  user_input = st.text_area("Enter your text here:")
31
  uploaded_file = st.file_uploader("Upload a PDF", type="pdf")
32
  if st.button("Summarize"):
33
- summary = ""
34
- if uploaded_file is not None:
 
 
35
  # Extract text from PDF
36
  file_content = load_pdf(uploaded_file)
37
  st.write("PDF uploaded successfully.")
38
  elif user_input:
39
  file_content = user_input
40
  else:
41
- st.write("Please upload a PDF or enter some text to summarize.")
42
  return
43
 
44
  # Perform extractive summarization
45
  if radio_selection == "Extractive":
46
  summary = summarize_with_textrank(file_content)
47
-
48
- st.session_state.summary = summary
49
 
50
  # Right column: Displaying text after pressing 'Summarize'
51
  with col3:
 
30
  user_input = st.text_area("Enter your text here:")
31
  uploaded_file = st.file_uploader("Upload a PDF", type="pdf")
32
  if st.button("Summarize"):
33
+ if uploaded_file and user_input:
34
+ st.warning("Please provide either text input or a PDF file, not both.")
35
+ return
36
+ elif uploaded_file:
37
  # Extract text from PDF
38
  file_content = load_pdf(uploaded_file)
39
  st.write("PDF uploaded successfully.")
40
  elif user_input:
41
  file_content = user_input
42
  else:
43
+ st.warning("Please upload a PDF or enter some text to summarize.")
44
  return
45
 
46
  # Perform extractive summarization
47
  if radio_selection == "Extractive":
48
  summary = summarize_with_textrank(file_content)
49
+ st.session_state.summary = summary
 
50
 
51
  # Right column: Displaying text after pressing 'Summarize'
52
  with col3: