Spaces:
Sleeping
Sleeping
notes73 commited on
Commit ·
a068684
1
Parent(s): 49c5823
Use environment variable for OpenAI API key
Browse files
app.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import openai
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
openai.api_key = "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Streamlit UI
|
| 8 |
st.set_page_config(page_title="AI Job Interview Coach", layout="centered")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import openai
|
| 3 |
|
| 4 |
+
# Get the OpenAI API key from the environment variable
|
| 5 |
+
openai.api_key = os.getenv("OPENAI_API_KEY")
|
| 6 |
+
|
| 7 |
+
# Raise an error if the API key is missing
|
| 8 |
+
if not openai.api_key:
|
| 9 |
+
raise ValueError("⚠️ OpenAI API key is missing! Add it in Hugging Face environment variables.")
|
| 10 |
+
|
| 11 |
|
| 12 |
# Streamlit UI
|
| 13 |
st.set_page_config(page_title="AI Job Interview Coach", layout="centered")
|