Spaces:
Running
Running
Create .env to config key
Browse files
README.md
CHANGED
@@ -73,9 +73,18 @@ pip install -r requirements.txt
|
|
73 |
|
74 |
4. **Configure the App**:
|
75 |
|
76 |
-
-
|
77 |
-
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
5. **Run the Streamlit App**:
|
81 |
|
|
|
73 |
|
74 |
4. **Configure the App**:
|
75 |
|
76 |
+
- Navigate to OpenAI Platform > API Keys to generate an API Key to run the model
|
77 |
+
- Create a `.env` file locally, this file is hidden and will be automatically ignored by `.gitignore`
|
78 |
+
|
79 |
+
```sh
|
80 |
+
touch .env
|
81 |
+
```
|
82 |
+
|
83 |
+
Inside `.env` file, pass the API Key into `OPENAI_API_KEY` value
|
84 |
+
|
85 |
+
```sh
|
86 |
+
OPENAI_API_KEY = "sk-..."
|
87 |
+
```
|
88 |
|
89 |
5. **Run the Streamlit App**:
|
90 |
|
apikey.py
CHANGED
@@ -1 +1,8 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import openai
|
3 |
+
|
4 |
+
from dotenv import load_dotenv, find_dotenv
|
5 |
+
|
6 |
+
_ = load_dotenv(find_dotenv())
|
7 |
+
|
8 |
+
openai_api_key = os.environ["OPENAI_API_KEY"]
|
app.py
CHANGED
@@ -12,10 +12,6 @@ from langchain.document_loaders import (
|
|
12 |
TextLoader,
|
13 |
)
|
14 |
|
15 |
-
from apikey import openai_api_key
|
16 |
-
|
17 |
-
os.environ["OPENAI_API_KEY"] = openai_api_key
|
18 |
-
|
19 |
|
20 |
def load_and_process_file(file_data):
|
21 |
"""
|
|
|
12 |
TextLoader,
|
13 |
)
|
14 |
|
|
|
|
|
|
|
|
|
15 |
|
16 |
def load_and_process_file(file_data):
|
17 |
"""
|