Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,16 +7,10 @@ load_dotenv()
|
|
7 |
import openai
|
8 |
from openai import ChatCompletion
|
9 |
|
10 |
-
openai.api_key = os.getenv('
|
11 |
# keys are here: https://platform.openai.com/auth/callback?code=ReZ4izEw0DwkUKrHR-Opxr5AMMgo9SojxC9pNHQUcjD6M&state=OGZFNDJmLlJGNlIwOUxlakpXZkVFfjNxNy02ZlFtLWN4eUcuOXJobXouSQ%3D%3D#
|
12 |
# Read this, https://blog.futuresmart.ai/building-a-gpt-4-chatbot-using-chatgpt-api-and-streamlit-chat
|
13 |
|
14 |
-
import streamlit as st
|
15 |
-
|
16 |
-
# Set the API key (replace "YOUR_API_KEY" with your actual OpenAI API key)
|
17 |
-
openai.api_key = 'YOUR_API_KEY'
|
18 |
-
|
19 |
-
|
20 |
|
21 |
|
22 |
# Define a function to chat with the model
|
@@ -35,10 +29,8 @@ import streamlit as st
|
|
35 |
from streamlit_chat import message
|
36 |
import os
|
37 |
from dotenv import load_dotenv
|
38 |
-
load_dotenv('api_key.env')
|
39 |
-
openai.api_key = os.environ.get('API_KEY')
|
40 |
-
|
41 |
|
|
|
42 |
|
43 |
|
44 |
def generate_response(prompt):
|
|
|
7 |
import openai
|
8 |
from openai import ChatCompletion
|
9 |
|
10 |
+
openai.api_key = os.getenv('OPENAI_KEY')
|
11 |
# keys are here: https://platform.openai.com/auth/callback?code=ReZ4izEw0DwkUKrHR-Opxr5AMMgo9SojxC9pNHQUcjD6M&state=OGZFNDJmLlJGNlIwOUxlakpXZkVFfjNxNy02ZlFtLWN4eUcuOXJobXouSQ%3D%3D#
|
12 |
# Read this, https://blog.futuresmart.ai/building-a-gpt-4-chatbot-using-chatgpt-api-and-streamlit-chat
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
# Define a function to chat with the model
|
|
|
29 |
from streamlit_chat import message
|
30 |
import os
|
31 |
from dotenv import load_dotenv
|
|
|
|
|
|
|
32 |
|
33 |
+
load_dotenv('api_key.env')
|
34 |
|
35 |
|
36 |
def generate_response(prompt):
|