Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,15 +13,20 @@ from utils.util import *
|
|
| 13 |
# from streamlit_chat import message
|
| 14 |
|
| 15 |
|
| 16 |
-
st.title("Welcome to RegBotBeta")
|
| 17 |
-
st.header("Powered by `LlamaIndex🦙` and `OpenAI
|
| 18 |
|
| 19 |
if "messages" not in st.session_state:
|
| 20 |
st.session_state.messages = []
|
| 21 |
|
| 22 |
index = None
|
| 23 |
|
| 24 |
-
api_key = st.text_input("Enter your OpenAI API key here:", type="password")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
if api_key:
|
| 27 |
resp = validate(api_key)
|
|
@@ -41,7 +46,7 @@ if index:
|
|
| 41 |
with st.chat_message(message["role"]):
|
| 42 |
st.markdown(message["content"])
|
| 43 |
|
| 44 |
-
if prompt := st.chat_input("
|
| 45 |
# Display user message in chat message container
|
| 46 |
st.chat_message("user").markdown(prompt)
|
| 47 |
|
|
|
|
| 13 |
# from streamlit_chat import message
|
| 14 |
|
| 15 |
|
| 16 |
+
st.title("Welcome to RegBotBeta 2.0")
|
| 17 |
+
st.header("Powered by `LlamaIndex🦙` and `OpenAI`")
|
| 18 |
|
| 19 |
if "messages" not in st.session_state:
|
| 20 |
st.session_state.messages = []
|
| 21 |
|
| 22 |
index = None
|
| 23 |
|
| 24 |
+
#api_key = st.text_input("Enter your OpenAI API key here:", type="password")
|
| 25 |
+
|
| 26 |
+
from dotenv import load_dotenv, find_dotenv
|
| 27 |
+
_ = load_dotenv(find_dotenv()) # read local .env file
|
| 28 |
+
|
| 29 |
+
api_key = os.environ['OPENAI_API_KEY']
|
| 30 |
|
| 31 |
if api_key:
|
| 32 |
resp = validate(api_key)
|
|
|
|
| 46 |
with st.chat_message(message["role"]):
|
| 47 |
st.markdown(message["content"])
|
| 48 |
|
| 49 |
+
if prompt := st.chat_input("Ask your question"):
|
| 50 |
# Display user message in chat message container
|
| 51 |
st.chat_message("user").markdown(prompt)
|
| 52 |
|