Alimubariz124 commited on
Commit
5454fc9
·
verified ·
1 Parent(s): f6e1980

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -3
main.py CHANGED
@@ -9,9 +9,20 @@ model = LlamaForCausalLM.from_pretrained(model_name)
9
  # Initialize the text generation pipeline
10
  llm_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
11
 
12
- # Load the prompt from the text file
13
- with open('website_text.txt', 'r') as file:
14
- prompt = file.read()
 
 
 
 
 
 
 
 
 
 
 
15
 
16
 
17
 
 
9
  # Initialize the text generation pipeline
10
  llm_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
11
 
12
+ import fitz # PyMuPDF
13
+
14
+ # Function to extract text from PDF
15
+ def extract_text_from_pdf(pdf_path):
16
+ document = fitz.open(pdf_path)
17
+ text = ""
18
+ for page_num in range(document.page_count):
19
+ page = document.load_page(page_num)
20
+ text += page.get_text()
21
+ return text
22
+
23
+ # Load the prompt from the PDF file
24
+ pdf_path = 'landon_Hotel.pdf'
25
+ prompt = extract_text_from_pdf(pdf_path)
26
 
27
 
28