Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,13 @@ import gradio as gr
|
|
| 20 |
openai_api_key = os.getenv("tauhid")
|
| 21 |
print(f"API key retrieved: {'[NOT FOUND]' if not openai_api_key else '[FOUND - first 4 chars: ' + openai_api_key[:4] + ']'}")
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Step 1: Load the System Prompt
|
| 24 |
prompt_path = "system_prompt.txt" # Ensure this file is in the same directory
|
| 25 |
if not os.path.exists(prompt_path):
|
|
|
|
| 20 |
openai_api_key = os.getenv("tauhid")
|
| 21 |
print(f"API key retrieved: {'[NOT FOUND]' if not openai_api_key else '[FOUND - first 4 chars: ' + openai_api_key[:4] + ']'}")
|
| 22 |
|
| 23 |
+
|
| 24 |
+
# Add this line to explicitly set the environment variable
|
| 25 |
+
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 26 |
+
|
| 27 |
+
# Then create embeddings
|
| 28 |
+
embeddings = OpenAIEmbeddings()
|
| 29 |
+
|
| 30 |
# Step 1: Load the System Prompt
|
| 31 |
prompt_path = "system_prompt.txt" # Ensure this file is in the same directory
|
| 32 |
if not os.path.exists(prompt_path):
|