Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,9 @@ st.set_page_config(page_title="HUD Audit Guide", page_icon="π", layout="cente
|
|
9 |
st.title("Ask the HUD Audit Guide π¬π€")
|
10 |
st.info("Check out more info on the complete HUD Audit Guide at the official [website](https://www.hudoig.gov/library/single-audit-guidance/hud-consolidated-audit-guide)", icon="π")
|
11 |
|
12 |
-
|
|
|
|
|
13 |
|
14 |
def generate_response(input_text):
|
15 |
llm = OpenAI(temperature=0.7, openai_api_key=openai_api_key)
|
@@ -34,10 +36,11 @@ index = load_data()
|
|
34 |
chat_engine = index.as_chat_engine(chat_mode="condense_question", verbose=True)
|
35 |
|
36 |
if prompt := st.chat_input("Your question"): # Prompt for user input and save to chat history
|
37 |
-
if not openai_api_key.startswith('sk-'):
|
38 |
-
|
39 |
-
else: # Only allow the user to proceed if it appears they've entered a valid OpenAI API key
|
40 |
-
|
|
|
41 |
|
42 |
for message in st.session_state.messages: # Display the prior chat messages
|
43 |
with st.chat_message(message["role"]):
|
|
|
9 |
st.title("Ask the HUD Audit Guide π¬π€")
|
10 |
st.info("Check out more info on the complete HUD Audit Guide at the official [website](https://www.hudoig.gov/library/single-audit-guidance/hud-consolidated-audit-guide)", icon="π")
|
11 |
|
12 |
+
|
13 |
+
#openai_api_key = st.sidebar.text_input('OpenAI API Key', type='password')
|
14 |
+
openai_api_key = "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"
|
15 |
|
16 |
def generate_response(input_text):
|
17 |
llm = OpenAI(temperature=0.7, openai_api_key=openai_api_key)
|
|
|
36 |
chat_engine = index.as_chat_engine(chat_mode="condense_question", verbose=True)
|
37 |
|
38 |
if prompt := st.chat_input("Your question"): # Prompt for user input and save to chat history
|
39 |
+
#if not openai_api_key.startswith('sk-'):
|
40 |
+
# st.warning('Please enter your OpenAI API key!', icon='β ')
|
41 |
+
#else: # Only allow the user to proceed if it appears they've entered a valid OpenAI API key
|
42 |
+
# st.session_state.messages.append({"role": "user", "content": prompt})
|
43 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
44 |
|
45 |
for message in st.session_state.messages: # Display the prior chat messages
|
46 |
with st.chat_message(message["role"]):
|