Darka001 commited on
Commit
97d9b1c
·
verified ·
1 Parent(s): e166cde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -153,17 +153,18 @@ def format_result(result):
153
 
154
  def generate_with_filters(message, subject_input, rubric, date_beg, date_end):
155
  if date_beg == "2010-01-01" and date_end == "2025-01-01":
156
- rag_chain_with_filters = RunnableParallel(
157
- {"context": db3.as_retriever(search_type="mmr", search_kwargs={"k": 15,
158
  "filter": {'$and': [{'subject': {
159
  '$in': subject_input}}, {
160
  'rubric': {
161
- '$in': rubric}}]}}),
 
 
162
  "question": RunnablePassthrough()}
163
  ).assign(answer=rag_chain_from_docs)
164
  else:
165
  rag_chain_with_filters = RunnableParallel(
166
- {"context": db3.as_retriever(search_type="mmr", search_kwargs={"k": 15,
167
  "filter": {'$and': [{'subject': {
168
  '$in': subject_input}}, {
169
  'rubric': {
@@ -279,6 +280,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo :
279
 
280
 
281
 
282
- demo.launch(share = False)
283
 
284
 
 
153
 
154
  def generate_with_filters(message, subject_input, rubric, date_beg, date_end):
155
  if date_beg == "2010-01-01" and date_end == "2025-01-01":
156
+ ret = db3.as_retriever( search_kwargs={"k": 15,
 
157
  "filter": {'$and': [{'subject': {
158
  '$in': subject_input}}, {
159
  'rubric': {
160
+ '$in': rubric}}]}})
161
+ rag_chain_with_filters = RunnableParallel(
162
+ {"context": ret,
163
  "question": RunnablePassthrough()}
164
  ).assign(answer=rag_chain_from_docs)
165
  else:
166
  rag_chain_with_filters = RunnableParallel(
167
+ {"context": db3.as_retriever( search_kwargs={"k": 15,
168
  "filter": {'$and': [{'subject': {
169
  '$in': subject_input}}, {
170
  'rubric': {
 
280
 
281
 
282
 
283
+ demo.launch(share = True, debug = True)
284
 
285