Update app.py
Browse files
app.py
CHANGED
|
@@ -223,9 +223,13 @@ def sanitize_input(text):
|
|
| 223 |
return ""
|
| 224 |
return bleach.clean(text.strip())
|
| 225 |
|
| 226 |
-
# Rule-based completeness engine with weighted scoring, updated to
|
| 227 |
-
def evaluate_readiness(logs, qa_report, punch_list_text, log_keywords):
|
| 228 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
# Log inputs for debugging
|
| 230 |
logging.info(f"Inputs - Logs: {logs}, QA Report: {qa_report}, Punch List: {punch_list_text}, Log Keywords: {log_keywords}")
|
| 231 |
|
|
@@ -381,8 +385,7 @@ with gr.Blocks(css="""
|
|
| 381 |
)
|
| 382 |
with gr.Row():
|
| 383 |
with gr.Column(scale=2):
|
| 384 |
-
logs_input = gr.Textbox(label="Project Logs", lines=5, placeholder="Enter project logs (e.g., 'Project
|
| 385 |
-
log_keywords_input = gr.Textbox(label="Log Keywords (Regex)", placeholder="Enter keywords or regex (e.g., 'complete|finished|done')")
|
| 386 |
qa_input = gr.Dropdown(
|
| 387 |
label="QA Report",
|
| 388 |
choices=["Approved", "Passed", "Cleared", "Pending", "Not Started"],
|
|
@@ -411,8 +414,8 @@ with gr.Blocks(css="""
|
|
| 411 |
|
| 412 |
# Chain the evaluation, PDF generation, and Salesforce record creation
|
| 413 |
submit_btn.click(
|
| 414 |
-
fn=evaluate_readiness,
|
| 415 |
-
inputs=[logs_input, qa_input, punch_input
|
| 416 |
outputs=[
|
| 417 |
score_output, checklist_output, missing_output, status_output, progress_output,
|
| 418 |
gr.State(), gr.State(), gr.State(), gr.State(), open_punch_items_output, status_output
|
|
|
|
| 223 |
return ""
|
| 224 |
return bleach.clean(text.strip())
|
| 225 |
|
| 226 |
+
# Rule-based completeness engine with weighted scoring, updated to make log_keywords optional
|
| 227 |
+
def evaluate_readiness(logs, qa_report, punch_list_text, log_keywords=None):
|
| 228 |
try:
|
| 229 |
+
# Use default regex if log_keywords is not provided
|
| 230 |
+
if not log_keywords:
|
| 231 |
+
log_keywords = r"complete|handover done|finished|closed|successful"
|
| 232 |
+
|
| 233 |
# Log inputs for debugging
|
| 234 |
logging.info(f"Inputs - Logs: {logs}, QA Report: {qa_report}, Punch List: {punch_list_text}, Log Keywords: {log_keywords}")
|
| 235 |
|
|
|
|
| 385 |
)
|
| 386 |
with gr.Row():
|
| 387 |
with gr.Column(scale=2):
|
| 388 |
+
logs_input = gr.Textbox(label="Project Logs", lines=5, placeholder="Enter project logs (e.g., 'Project complete, handover done')")
|
|
|
|
| 389 |
qa_input = gr.Dropdown(
|
| 390 |
label="QA Report",
|
| 391 |
choices=["Approved", "Passed", "Cleared", "Pending", "Not Started"],
|
|
|
|
| 414 |
|
| 415 |
# Chain the evaluation, PDF generation, and Salesforce record creation
|
| 416 |
submit_btn.click(
|
| 417 |
+
fn=lambda logs, qa, punch: evaluate_readiness(logs, qa, punch, None),
|
| 418 |
+
inputs=[logs_input, qa_input, punch_input],
|
| 419 |
outputs=[
|
| 420 |
score_output, checklist_output, missing_output, status_output, progress_output,
|
| 421 |
gr.State(), gr.State(), gr.State(), gr.State(), open_punch_items_output, status_output
|