Update main.py
Browse files
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
|
16 |
-
client = genai.Client(api_key=
|
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 |
|