Spaces:
Sleeping
Sleeping
key
Browse files
bill.py
CHANGED
|
@@ -4,6 +4,15 @@ import os
|
|
| 4 |
import json
|
| 5 |
import streamlit as st
|
| 6 |
from openai import OpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
client = OpenAI()
|
| 9 |
|
|
|
|
| 4 |
import json
|
| 5 |
import streamlit as st
|
| 6 |
from openai import OpenAI
|
| 7 |
+
from dotenv import load_dotenv
|
| 8 |
+
|
| 9 |
+
# Load environment variables from .env file
|
| 10 |
+
load_dotenv()
|
| 11 |
+
|
| 12 |
+
# Get the OpenAI API key from environment variables
|
| 13 |
+
api_key = os.getenv("OPENAI_API_KEY")
|
| 14 |
+
if not api_key:
|
| 15 |
+
raise ValueError("The OPENAI_API_KEY environment variable is not set.")
|
| 16 |
|
| 17 |
client = OpenAI()
|
| 18 |
|