yashasgupta commited on
Commit
4a2a968
1 Parent(s): 8f74b08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -44,10 +44,13 @@ from langchain_text_splitters import NLTKTextSplitter
44
 
45
  uploaded_file = st.file_uploader("Choose a pdf file",type = "pdf")
46
 
47
- pdf_loader = PDFMinerLoader(uploaded_file)
48
- dat_nik = pdf_loader.load()
49
- text_splitter = NLTKTextSplitter(chunk_size = 500,chunk_overlap = 100)
50
- chunks = test_splitter.split_documents(dat_nik)
 
 
 
51
 
52
  # dat = PDFMinerLoader("2404.07143.pdf")
53
  # dat_nik =dat.load()
 
44
 
45
  uploaded_file = st.file_uploader("Choose a pdf file",type = "pdf")
46
 
47
+ if uploaded_file is not None:
48
+ pdf_loader = PDFMinerLoader(uploaded_file)
49
+ dat_nik = pdf_loader.load()
50
+ text_splitter = NLTKTextSplitter(chunk_size = 500,chunk_overlap = 100)
51
+ chunks = test_splitter.split_documents(dat_nik)
52
+ else:
53
+ st.write("Please upload a pdf")
54
 
55
  # dat = PDFMinerLoader("2404.07143.pdf")
56
  # dat_nik =dat.load()