Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -534,11 +534,9 @@ def create_docx(content):
|
|
| 534 |
def download_shred(n_clicks, shred_output):
|
| 535 |
if shred_output is None:
|
| 536 |
return dash.no_update
|
| 537 |
-
|
| 538 |
-
doc = create_docx(content)
|
| 539 |
buffer = BytesIO()
|
| 540 |
doc.save(buffer)
|
| 541 |
-
buffer.seek(0)
|
| 542 |
return dcc.send_bytes(buffer.getvalue(), "shred_outline.docx")
|
| 543 |
|
| 544 |
@app.callback(
|
|
@@ -550,11 +548,9 @@ def download_shred(n_clicks, shred_output):
|
|
| 550 |
def download_pink(n_clicks, pink_output):
|
| 551 |
if pink_output is None:
|
| 552 |
return dash.no_update
|
| 553 |
-
|
| 554 |
-
doc = create_docx(content)
|
| 555 |
buffer = BytesIO()
|
| 556 |
doc.save(buffer)
|
| 557 |
-
buffer.seek(0)
|
| 558 |
return dcc.send_bytes(buffer.getvalue(), "pink_team_document.docx")
|
| 559 |
|
| 560 |
@app.callback(
|
|
@@ -566,11 +562,9 @@ def download_pink(n_clicks, pink_output):
|
|
| 566 |
def download_p_review(n_clicks, p_review_output):
|
| 567 |
if p_review_output is None:
|
| 568 |
return dash.no_update
|
| 569 |
-
|
| 570 |
-
doc = create_docx(content)
|
| 571 |
buffer = BytesIO()
|
| 572 |
doc.save(buffer)
|
| 573 |
-
buffer.seek(0)
|
| 574 |
return dcc.send_bytes(buffer.getvalue(), "p_review_report.docx")
|
| 575 |
|
| 576 |
@app.callback(
|
|
@@ -582,11 +576,9 @@ def download_p_review(n_clicks, p_review_output):
|
|
| 582 |
def download_red(n_clicks, red_output):
|
| 583 |
if red_output is None:
|
| 584 |
return dash.no_update
|
| 585 |
-
|
| 586 |
-
doc = create_docx(content)
|
| 587 |
buffer = BytesIO()
|
| 588 |
doc.save(buffer)
|
| 589 |
-
buffer.seek(0)
|
| 590 |
return dcc.send_bytes(buffer.getvalue(), "red_team_document.docx")
|
| 591 |
|
| 592 |
@app.callback(
|
|
@@ -598,11 +590,9 @@ def download_red(n_clicks, red_output):
|
|
| 598 |
def download_r_review(n_clicks, r_review_output):
|
| 599 |
if r_review_output is None:
|
| 600 |
return dash.no_update
|
| 601 |
-
|
| 602 |
-
doc = create_docx(content)
|
| 603 |
buffer = BytesIO()
|
| 604 |
doc.save(buffer)
|
| 605 |
-
buffer.seek(0)
|
| 606 |
return dcc.send_bytes(buffer.getvalue(), "r_review_report.docx")
|
| 607 |
|
| 608 |
@app.callback(
|
|
@@ -614,11 +604,9 @@ def download_r_review(n_clicks, r_review_output):
|
|
| 614 |
def download_g_review(n_clicks, g_review_output):
|
| 615 |
if g_review_output is None:
|
| 616 |
return dash.no_update
|
| 617 |
-
|
| 618 |
-
doc = create_docx(content)
|
| 619 |
buffer = BytesIO()
|
| 620 |
doc.save(buffer)
|
| 621 |
-
buffer.seek(0)
|
| 622 |
return dcc.send_bytes(buffer.getvalue(), "g_review_report.docx")
|
| 623 |
|
| 624 |
@app.callback(
|
|
@@ -627,6 +615,14 @@ def download_g_review(n_clicks, g_review_output):
|
|
| 627 |
State('loe-output', 'children'),
|
| 628 |
prevent_initial_call=True,
|
| 629 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 630 |
|
| 631 |
@app.callback(
|
| 632 |
Output('loe-output', 'children'),
|
|
|
|
| 534 |
def download_shred(n_clicks, shred_output):
|
| 535 |
if shred_output is None:
|
| 536 |
return dash.no_update
|
| 537 |
+
doc = create_docx(shred_output)
|
|
|
|
| 538 |
buffer = BytesIO()
|
| 539 |
doc.save(buffer)
|
|
|
|
| 540 |
return dcc.send_bytes(buffer.getvalue(), "shred_outline.docx")
|
| 541 |
|
| 542 |
@app.callback(
|
|
|
|
| 548 |
def download_pink(n_clicks, pink_output):
|
| 549 |
if pink_output is None:
|
| 550 |
return dash.no_update
|
| 551 |
+
doc = create_docx(pink_output)
|
|
|
|
| 552 |
buffer = BytesIO()
|
| 553 |
doc.save(buffer)
|
|
|
|
| 554 |
return dcc.send_bytes(buffer.getvalue(), "pink_team_document.docx")
|
| 555 |
|
| 556 |
@app.callback(
|
|
|
|
| 562 |
def download_p_review(n_clicks, p_review_output):
|
| 563 |
if p_review_output is None:
|
| 564 |
return dash.no_update
|
| 565 |
+
doc = create_docx(p_review_output)
|
|
|
|
| 566 |
buffer = BytesIO()
|
| 567 |
doc.save(buffer)
|
|
|
|
| 568 |
return dcc.send_bytes(buffer.getvalue(), "p_review_report.docx")
|
| 569 |
|
| 570 |
@app.callback(
|
|
|
|
| 576 |
def download_red(n_clicks, red_output):
|
| 577 |
if red_output is None:
|
| 578 |
return dash.no_update
|
| 579 |
+
doc = create_docx(red_output)
|
|
|
|
| 580 |
buffer = BytesIO()
|
| 581 |
doc.save(buffer)
|
|
|
|
| 582 |
return dcc.send_bytes(buffer.getvalue(), "red_team_document.docx")
|
| 583 |
|
| 584 |
@app.callback(
|
|
|
|
| 590 |
def download_r_review(n_clicks, r_review_output):
|
| 591 |
if r_review_output is None:
|
| 592 |
return dash.no_update
|
| 593 |
+
doc = create_docx(r_review_output)
|
|
|
|
| 594 |
buffer = BytesIO()
|
| 595 |
doc.save(buffer)
|
|
|
|
| 596 |
return dcc.send_bytes(buffer.getvalue(), "r_review_report.docx")
|
| 597 |
|
| 598 |
@app.callback(
|
|
|
|
| 604 |
def download_g_review(n_clicks, g_review_output):
|
| 605 |
if g_review_output is None:
|
| 606 |
return dash.no_update
|
| 607 |
+
doc = create_docx(g_review_output)
|
|
|
|
| 608 |
buffer = BytesIO()
|
| 609 |
doc.save(buffer)
|
|
|
|
| 610 |
return dcc.send_bytes(buffer.getvalue(), "g_review_report.docx")
|
| 611 |
|
| 612 |
@app.callback(
|
|
|
|
| 615 |
State('loe-output', 'children'),
|
| 616 |
prevent_initial_call=True,
|
| 617 |
)
|
| 618 |
+
def download_loe(n_clicks, loe_output):
|
| 619 |
+
if loe_output is None or isinstance(loe_output, str):
|
| 620 |
+
return dash.no_update
|
| 621 |
+
loe_text = loe_output[0]['props']['children']
|
| 622 |
+
doc = create_docx(loe_text)
|
| 623 |
+
buffer = BytesIO()
|
| 624 |
+
doc.save(buffer)
|
| 625 |
+
return dcc.send_bytes(buffer.getvalue(), "loe_report.docx")
|
| 626 |
|
| 627 |
@app.callback(
|
| 628 |
Output('loe-output', 'children'),
|