Spaces:
Paused
Paused
Update app.py via AI Editor
Browse files
app.py
CHANGED
|
@@ -234,7 +234,6 @@ def process_document(action, selected_filename=None, chat_input=None, rfp_decode
|
|
| 234 |
return result, None, None, None, None
|
| 235 |
|
| 236 |
elif action == 'virtual_board':
|
| 237 |
-
# Implementation for extracting evaluation criteria (L & M) and evaluating proposal
|
| 238 |
if not selected_proposal_filename or selected_proposal_filename not in proposals:
|
| 239 |
return "No proposal document selected for evaluation board.", None, None, None, None
|
| 240 |
if not selected_filename or selected_filename not in uploaded_documents:
|
|
@@ -244,10 +243,12 @@ def process_document(action, selected_filename=None, chat_input=None, rfp_decode
|
|
| 244 |
proposal_text = proposals[selected_proposal_filename]
|
| 245 |
logging.info(f"Evaluation Board: extracting criteria from RFP [{selected_filename}], evaluating proposal [{selected_proposal_filename}]")
|
| 246 |
prompt = (
|
| 247 |
-
"You are a federal acquisition evaluation board.
|
| 248 |
-
"
|
|
|
|
|
|
|
| 249 |
"Return ONLY a markdown spreadsheet/table (NO intro, NO outro, NO comments, NO summary) with exactly these columns: | Evaluation Criteria | Evaluation (unacceptable/acceptable/good/outstanding) |. "
|
| 250 |
-
"Each row should have
|
| 251 |
f"---\nRFP/SOW/PWS/RFI ({selected_filename}):\n{rfp_text}\n"
|
| 252 |
"---\nProposal Document:\n"
|
| 253 |
f"{proposal_text}\n"
|
|
@@ -507,6 +508,7 @@ app.layout = dbc.Container([
|
|
| 507 |
Input('proposal-action-btn', 'n_clicks'),
|
| 508 |
Input('compliance-action-btn', 'n_clicks'),
|
| 509 |
Input('recover-action-btn', 'n_clicks'),
|
|
|
|
| 510 |
Input('upload-document', 'contents'),
|
| 511 |
State('upload-document', 'filename'),
|
| 512 |
Input({'type': 'delete-doc-btn', 'index': ALL, 'group': 'doc'}, 'n_clicks'),
|
|
@@ -521,7 +523,7 @@ app.layout = dbc.Container([
|
|
| 521 |
prevent_initial_call=True
|
| 522 |
)
|
| 523 |
def master_callback(
|
| 524 |
-
shred_clicks, proposal_clicks, compliance_clicks, recover_clicks,
|
| 525 |
rfp_content, rfp_filename, doc_delete_clicks, selected_doc,
|
| 526 |
proposal_content, proposal_filename, proposal_delete_clicks, selected_proposal,
|
| 527 |
chat_input, cancel_clicks
|
|
@@ -535,8 +537,8 @@ def master_callback(
|
|
| 535 |
except Exception:
|
| 536 |
return []
|
| 537 |
|
| 538 |
-
doc_delete_clicks = safe_get_n_clicks(ctx,
|
| 539 |
-
proposal_delete_clicks = safe_get_n_clicks(ctx,
|
| 540 |
uploaded_rfp_decoded_bytes = None
|
| 541 |
|
| 542 |
global gemini_lock, uploaded_documents_bytes
|
|
@@ -590,7 +592,7 @@ def master_callback(
|
|
| 590 |
if triggered_id and isinstance(doc_delete_clicks, list):
|
| 591 |
for i, n_click in enumerate(doc_delete_clicks):
|
| 592 |
if n_click:
|
| 593 |
-
btn_id = ctx.inputs_list[
|
| 594 |
del_filename = btn_id['index']
|
| 595 |
if del_filename in uploaded_documents:
|
| 596 |
del uploaded_documents[del_filename]
|
|
@@ -613,7 +615,7 @@ def master_callback(
|
|
| 613 |
if triggered_id and isinstance(proposal_delete_clicks, list):
|
| 614 |
for i, n_click in enumerate(proposal_delete_clicks):
|
| 615 |
if n_click:
|
| 616 |
-
btn_id = ctx.inputs_list[
|
| 617 |
del_filename = btn_id['index']
|
| 618 |
if del_filename in proposals:
|
| 619 |
del proposals[del_filename]
|
|
|
|
| 234 |
return result, None, None, None, None
|
| 235 |
|
| 236 |
elif action == 'virtual_board':
|
|
|
|
| 237 |
if not selected_proposal_filename or selected_proposal_filename not in proposals:
|
| 238 |
return "No proposal document selected for evaluation board.", None, None, None, None
|
| 239 |
if not selected_filename or selected_filename not in uploaded_documents:
|
|
|
|
| 243 |
proposal_text = proposals[selected_proposal_filename]
|
| 244 |
logging.info(f"Evaluation Board: extracting criteria from RFP [{selected_filename}], evaluating proposal [{selected_proposal_filename}]")
|
| 245 |
prompt = (
|
| 246 |
+
"You are a federal acquisition evaluation board. Your job is to extract Section L and Section M (evaluation criteria) from the following RFP/SOW/PWS/RFI if they exist. "
|
| 247 |
+
"If Section L or Section M are not present, then read all requirements and develop a set of evaluation criteria that would be appropriate for this type of acquisition. "
|
| 248 |
+
"List each evaluation criterion exactly as it appears in the document or as you have developed. "
|
| 249 |
+
"For each extracted or developed evaluation criterion, evaluate the provided proposal and rate it as exactly one of: unacceptable, acceptable, good, or outstanding (no other ratings allowed). "
|
| 250 |
"Return ONLY a markdown spreadsheet/table (NO intro, NO outro, NO comments, NO summary) with exactly these columns: | Evaluation Criteria | Evaluation (unacceptable/acceptable/good/outstanding) |. "
|
| 251 |
+
"Each row should have the criterion exactly as extracted or developed, and the evaluation for how well the proposal meets or exceeds it. Only the table, nothing else.\n\n"
|
| 252 |
f"---\nRFP/SOW/PWS/RFI ({selected_filename}):\n{rfp_text}\n"
|
| 253 |
"---\nProposal Document:\n"
|
| 254 |
f"{proposal_text}\n"
|
|
|
|
| 508 |
Input('proposal-action-btn', 'n_clicks'),
|
| 509 |
Input('compliance-action-btn', 'n_clicks'),
|
| 510 |
Input('recover-action-btn', 'n_clicks'),
|
| 511 |
+
Input('board-action-btn', 'n_clicks'),
|
| 512 |
Input('upload-document', 'contents'),
|
| 513 |
State('upload-document', 'filename'),
|
| 514 |
Input({'type': 'delete-doc-btn', 'index': ALL, 'group': 'doc'}, 'n_clicks'),
|
|
|
|
| 523 |
prevent_initial_call=True
|
| 524 |
)
|
| 525 |
def master_callback(
|
| 526 |
+
shred_clicks, proposal_clicks, compliance_clicks, recover_clicks, board_clicks,
|
| 527 |
rfp_content, rfp_filename, doc_delete_clicks, selected_doc,
|
| 528 |
proposal_content, proposal_filename, proposal_delete_clicks, selected_proposal,
|
| 529 |
chat_input, cancel_clicks
|
|
|
|
| 537 |
except Exception:
|
| 538 |
return []
|
| 539 |
|
| 540 |
+
doc_delete_clicks = safe_get_n_clicks(ctx, 7)
|
| 541 |
+
proposal_delete_clicks = safe_get_n_clicks(ctx, 11)
|
| 542 |
uploaded_rfp_decoded_bytes = None
|
| 543 |
|
| 544 |
global gemini_lock, uploaded_documents_bytes
|
|
|
|
| 592 |
if triggered_id and isinstance(doc_delete_clicks, list):
|
| 593 |
for i, n_click in enumerate(doc_delete_clicks):
|
| 594 |
if n_click:
|
| 595 |
+
btn_id = ctx.inputs_list[7][i]['id']
|
| 596 |
del_filename = btn_id['index']
|
| 597 |
if del_filename in uploaded_documents:
|
| 598 |
del uploaded_documents[del_filename]
|
|
|
|
| 615 |
if triggered_id and isinstance(proposal_delete_clicks, list):
|
| 616 |
for i, n_click in enumerate(proposal_delete_clicks):
|
| 617 |
if n_click:
|
| 618 |
+
btn_id = ctx.inputs_list[11][i]['id']
|
| 619 |
del_filename = btn_id['index']
|
| 620 |
if del_filename in proposals:
|
| 621 |
del proposals[del_filename]
|