Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -149,7 +149,7 @@ async def answer_batch_questions(request: Request, body: QueryRequest):
|
|
149 |
except Exception as e:
|
150 |
raise HTTPException(status_code=500, detail=f"PDF processing error: {str(e)}")
|
151 |
|
152 |
-
|
153 |
# client = InferenceClient(
|
154 |
# provider=hf_provider,
|
155 |
# api_key=os.environ["HF_TOKEN"],
|
@@ -157,7 +157,7 @@ async def answer_batch_questions(request: Request, body: QueryRequest):
|
|
157 |
|
158 |
# system="You are a helpful assistant answering questions from contracts and policies."
|
159 |
answers = []
|
160 |
-
|
161 |
matched_clauses = retriever.search(question, top_k=5)
|
162 |
|
163 |
prompt = build_prompt(question, matched_clauses)
|
|
|
149 |
except Exception as e:
|
150 |
raise HTTPException(status_code=500, detail=f"PDF processing error: {str(e)}")
|
151 |
|
152 |
+
retriever = ClauseQueryEngine(model_name=embedding_model)
|
153 |
# client = InferenceClient(
|
154 |
# provider=hf_provider,
|
155 |
# api_key=os.environ["HF_TOKEN"],
|
|
|
157 |
|
158 |
# system="You are a helpful assistant answering questions from contracts and policies."
|
159 |
answers = []
|
160 |
+
for question in body.questions:
|
161 |
matched_clauses = retriever.search(question, top_k=5)
|
162 |
|
163 |
prompt = build_prompt(question, matched_clauses)
|