Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,15 @@ import streamlit as st
|
|
| 2 |
from docx import Document
|
| 3 |
from openai import OpenAI
|
| 4 |
import io
|
|
|
|
| 5 |
|
| 6 |
# Initialize OpenAI client
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Department and Role mapping
|
| 10 |
DEPARTMENT_ROLES = {
|
|
|
|
| 2 |
from docx import Document
|
| 3 |
from openai import OpenAI
|
| 4 |
import io
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
# Initialize OpenAI client
|
| 8 |
+
api_key = os.getenv("OPENAI_API_KEY") # Read API key from environment variable
|
| 9 |
+
if not api_key:
|
| 10 |
+
st.error("OpenAI API key not found. Please set the OPENAI_API_KEY environment variable.")
|
| 11 |
+
st.stop()
|
| 12 |
+
|
| 13 |
+
client = OpenAI(api_key=api_key)
|
| 14 |
|
| 15 |
# Department and Role mapping
|
| 16 |
DEPARTMENT_ROLES = {
|