Hammad712 commited on
Commit
eeb1801
·
verified ·
1 Parent(s): 58a38e6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -8,12 +8,16 @@ import cv2
8
  from PIL import Image
9
  from pdf2image import convert_from_bytes
10
 
 
 
 
 
11
  # Import the Google GenAI client libraries.
12
  from google import genai
13
  from google.genai import types
14
 
15
- # Initialize the GenAI client with your API key.
16
- client = genai.Client(api_key="AIzaSyDDDHg9GWl6-9aq9Wo43GHfk2wcakhgwBQ")
17
 
18
  app = FastAPI(title="Student Result Card API")
19
 
 
8
  from PIL import Image
9
  from pdf2image import convert_from_bytes
10
 
11
+ GENAI_API_KEY = os.getenv("GENAI_API_KEY")
12
+ if not GENAI_API_KEY:
13
+ raise Exception("GENAI_API_KEY not set in .env file.")
14
+
15
  # Import the Google GenAI client libraries.
16
  from google import genai
17
  from google.genai import types
18
 
19
+ # Initialize the GenAI client with the API key from .env.
20
+ client = genai.Client(api_key=GENAI_API_KEY)
21
 
22
  app = FastAPI(title="Student Result Card API")
23