hashirehtisham commited on
Commit
a39245c
·
verified ·
1 Parent(s): 8afb4fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import streamlit as st
2
  from ai71 import AI71
 
3
 
4
  # Initialize AI71 client
5
- AI71_API_KEY = "ai71-api-d95427d8-ce80-42cb-8117-cd12ecfe7907" # Your API key
6
  client = AI71(AI71_API_KEY)
7
 
 
8
  def respond(
9
  message,
10
  history: list[tuple[str, str]],
@@ -14,7 +16,6 @@ def respond(
14
  top_p,
15
  ):
16
  messages = [{"role": "system", "content": system_message}]
17
-
18
  for val in history:
19
  if val[0]:
20
  messages.append({"role": "user", "content": val[0]})
@@ -95,4 +96,4 @@ if 'history' not in st.session_state:
95
  # Display chat history above the message input
96
  st.text_area("Chat History", value="\n\n".join([f"User: {h[0]}\n\nAI Lawyer: {h[1]}" for h in st.session_state.history]), height=400, key="chat_history")
97
 
98
- message = st.text_input("Your message", key="new_message", on_change=send_message)
 
1
  import streamlit as st
2
  from ai71 import AI71
3
+ import os
4
 
5
  # Initialize AI71 client
6
+ AI71_API_KEY = os.getenv("AI71_API_KEY") # Access the secret from environment variables
7
  client = AI71(AI71_API_KEY)
8
 
9
+ # Define your functions and Streamlit UI
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
 
16
  top_p,
17
  ):
18
  messages = [{"role": "system", "content": system_message}]
 
19
  for val in history:
20
  if val[0]:
21
  messages.append({"role": "user", "content": val[0]})
 
96
  # Display chat history above the message input
97
  st.text_area("Chat History", value="\n\n".join([f"User: {h[0]}\n\nAI Lawyer: {h[1]}" for h in st.session_state.history]), height=400, key="chat_history")
98
 
99
+ message = st.text_input("Your message", key="new_message", on_change=send_message)