Skip to content

Commit

Permalink
Updated chatbot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
samridhi171 committed Aug 25, 2024
1 parent cd1da9e commit 79363a6
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,30 @@
# Set the API key directly here and change this according to your API
api_key = "AIzaSyArJVsC_iaUDJqOCUsRTa3QwYheNgoTTaI"

from PyPDF2 import PdfReader, PdfWriter

def extract_pages(input_pdf_path, output_pdf_path, start_page, end_page):
reader = PdfReader(input_pdf_path)
writer = PdfWriter()

# Adjusting for 0-based indexing
for i in range(start_page - 1, end_page):
writer.add_page(reader.pages[i])

with open(output_pdf_path, 'wb') as output_pdf:
writer.write(output_pdf)

# Example usage
input_pdf_path = "Harrison's Principles of Internal Medicine, 20th Edition 2020.pdf"
pdf_paths = "Harrison's_Extracted_Pages.pdf"
start_page = 100 # Start from the first page
end_page = 700 # Extract up to the 500th page

extract_pages(input_pdf_path, pdf_paths, start_page, end_page)


# Set PDF file paths directly here and change it accordingly
pdf_paths = [r"DIABETES.pdf"]
pdf_paths = [r"Harrison's_Extracted_Pages.pdf"]

# Set page configuration
st.set_page_config(page_title="Medical Bot", layout="wide")
Expand Down

0 comments on commit 79363a6

Please sign in to comment.