yuvraj-yadav commited on
Commit
e9ec0e9
·
verified ·
1 Parent(s): dabc3da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -6,6 +6,12 @@ import fitz # PyMuPDF to read PDF
6
 
7
  # Load Gemini API key from Hugging Face secret
8
  genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
 
 
 
 
 
 
9
  for page in doc:
10
  text += page.get_text()
11
  return text.strip()
 
6
 
7
  # Load Gemini API key from Hugging Face secret
8
  genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
9
+ model = genai.GenerativeModel("gemini-pro")
10
+
11
+ # PDF reading utility
12
+ def extract_text_from_pdf(pdf_file):
13
+ text = ""
14
+ doc = fitz.open(pdf_file.name)
15
  for page in doc:
16
  text += page.get_text()
17
  return text.strip()