AkashDataScience commited on
Commit
9c46b79
·
1 Parent(s): 1e93f98
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -26,7 +26,9 @@ prompt = PromptTemplate(template = prompt_template, input_variables = ["context"
26
  chain = prompt | gemini
27
 
28
  def inference(pdf_path, chunk_size, chunk_overlap):
29
- raw_documents = PyPDFLoader(pdf_path).load()
 
 
30
  text_splitter = CharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap)
31
  documents = text_splitter.split_documents(raw_documents)
32
 
@@ -57,7 +59,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
57
  gr.Markdown(f"# {title}\n{description}")
58
  with gr.Row():
59
  with gr.Column():
60
- pdf = gr.File(label="Upload your PDF Files", file_count="multiple", file_types=[".pdf"])
61
  chunk_size = gr.Slider(0, 2000, 1000, 100, label="Size of Chunk")
62
  chunk_overlap = gr.Slider(0, 1000, 100, 100, label="Size of Chunk Overlap")
63
  with gr.Row():
 
26
  chain = prompt | gemini
27
 
28
  def inference(pdf_path, chunk_size, chunk_overlap):
29
+ raw_documents = []
30
+ for path in pdf_path:
31
+ raw_documents.extend(PyPDFLoader(path).load())
32
  text_splitter = CharacterTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap)
33
  documents = text_splitter.split_documents(raw_documents)
34
 
 
59
  gr.Markdown(f"# {title}\n{description}")
60
  with gr.Row():
61
  with gr.Column():
62
+ pdf = gr.File(label="Input PDFs", file_count="multiple", file_types=[".pdf"])
63
  chunk_size = gr.Slider(0, 2000, 1000, 100, label="Size of Chunk")
64
  chunk_overlap = gr.Slider(0, 1000, 100, 100, label="Size of Chunk Overlap")
65
  with gr.Row():