PRIYANSHUDHAKED commited on
Commit
ffc4ebe
·
verified ·
1 Parent(s): a3a7320

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -17,12 +17,21 @@ app = FastAPI()
17
  # Set up logging
18
  logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s')
19
 
20
- load_dotenv()
21
- # Configure genai with the API key
22
- api_key = os.getenv("AIzaSyD0GxR2J1JxGic807Cc89Jq6MB4aDJYgDc")
 
 
 
 
 
 
23
  if not api_key:
24
  raise EnvironmentError("Google API Key not found in environment variables.")
25
- genai.configure(api_key=api_key)
 
 
 
26
 
27
  def get_pdf_text(pdf_docs):
28
  text = ""
 
17
  # Set up logging
18
  logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s')
19
 
20
+ import google.generativeai as genai
21
+ from dotenv import load_dotenv
22
+ import os
23
+
24
+ # Load environment variables from .env file
25
+ load_dotenv()
26
+
27
+ # Retrieve the API key from the environment
28
+ api_key = os.getenv("GOOGLE_API_KEY")
29
  if not api_key:
30
  raise EnvironmentError("Google API Key not found in environment variables.")
31
+
32
+ # Configure Google Generative AI
33
+ genai.configure(api_key=api_key)
34
+
35
 
36
  def get_pdf_text(pdf_docs):
37
  text = ""