Akshayram1 commited on
Commit
065a97b
1 Parent(s): 30c5c42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -13,8 +13,10 @@ import tempfile
13
 
14
  # Streamlit specific setup
15
  st.title("Uber Quarterly Report QA")
16
- user_llama_key = st.text_input("Enter your LLAMA Cloud API key:")
17
- user_groq_key = st.text_input("Enter your GROQ API key:")
 
 
18
 
19
  # Function to load or parse data from uploaded PDF file
20
  def load_or_parse_data(uploaded_file):
@@ -25,7 +27,7 @@ def load_or_parse_data(uploaded_file):
25
  parsing_instruction = """The provided document is a quarterly report filed by Uber Technologies,
26
  Inc. with the Securities and Exchange Commission (SEC)...
27
  """
28
- parser = LlamaParse(api_key=user_llama_key, result_type="markdown", parsing_instruction=parsing_instruction, max_timeout=5000)
29
  llama_parse_documents = parser.load_data(temp_file_path)
30
  os.remove(temp_file_path)
31
  return llama_parse_documents
@@ -64,7 +66,7 @@ if uploaded_file is not None:
64
  chat_model = ChatGroq(
65
  temperature=0,
66
  model_name="mixtral-8x7b-32768",
67
- api_key=user_groq_key
68
  )
69
 
70
  # Convert retrieved documents into QA format
 
13
 
14
  # Streamlit specific setup
15
  st.title("Uber Quarterly Report QA")
16
+
17
+ # Access API keys from secrets
18
+ llama_cloud_api_key = st.secrets["llama_cloud_api_key"]
19
+ groq_api_key = st.secrets["groq_api_key"]
20
 
21
  # Function to load or parse data from uploaded PDF file
22
  def load_or_parse_data(uploaded_file):
 
27
  parsing_instruction = """The provided document is a quarterly report filed by Uber Technologies,
28
  Inc. with the Securities and Exchange Commission (SEC)...
29
  """
30
+ parser = LlamaParse(api_key=llama_cloud_api_key, result_type="markdown", parsing_instruction=parsing_instruction, max_timeout=5000)
31
  llama_parse_documents = parser.load_data(temp_file_path)
32
  os.remove(temp_file_path)
33
  return llama_parse_documents
 
66
  chat_model = ChatGroq(
67
  temperature=0,
68
  model_name="mixtral-8x7b-32768",
69
+ api_key=groq_api_key
70
  )
71
 
72
  # Convert retrieved documents into QA format