AceVen57 commited on
Commit
f2200c4
·
verified ·
1 Parent(s): ec1db20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -170,10 +170,10 @@ Here are some documents that are relevant to the question.
170
  """
171
 
172
  # Define the predict function that runs when 'Submit' is clicked or when a API request is made
173
- def predict(user_input,company):
174
  api_key = os.getenv("FIREWORKS_API_KEY")
175
- filter = "dataset/"+company+"-10-k-2023.pdf"
176
- relevant_document_chunks = vectorstore_persisted.similarity_search(user_input, k=5, filter={"source":filter})
177
 
178
  # Create context_for_query
179
  context_list = [d.page_content for d in relevant_document_chunks]
@@ -247,7 +247,7 @@ examples = [
247
  ["How does Meta plan to differentiate itself in the AI space relative to competitors?","Meta"]
248
  ]
249
 
250
- def get_predict(question, company):
251
  # Implement your prediction logic here
252
  if company == "AWS":
253
  # Perform prediction for AWS
@@ -288,7 +288,7 @@ with gr.Blocks(theme="Taithrah/Minimal@>=0.0.1,<0.1.0") as demo:
288
 
289
  submit.click(
290
  fn=get_predict,
291
- inputs=[question, company],
292
  outputs=output
293
  )
294
  examples_component = gr.Examples(examples=examples, inputs=[question, company])
 
170
  """
171
 
172
  # Define the predict function that runs when 'Submit' is clicked or when a API request is made
173
+ def predict(user_input,company,vectorstore_persisted):
174
  api_key = os.getenv("FIREWORKS_API_KEY")
175
+ filter_text = "dataset/"+company+"-10-k-2023.pdf"
176
+ relevant_document_chunks = vectorstore_persisted.similarity_search(user_input, k=5, filter={"source":filter_text})
177
 
178
  # Create context_for_query
179
  context_list = [d.page_content for d in relevant_document_chunks]
 
247
  ["How does Meta plan to differentiate itself in the AI space relative to competitors?","Meta"]
248
  ]
249
 
250
+ def get_predict(question, company, vectorstore_persisted):
251
  # Implement your prediction logic here
252
  if company == "AWS":
253
  # Perform prediction for AWS
 
288
 
289
  submit.click(
290
  fn=get_predict,
291
+ inputs=[question, company, vectorstore_persisted],
292
  outputs=output
293
  )
294
  examples_component = gr.Examples(examples=examples, inputs=[question, company])