Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -571,9 +571,10 @@ def answer_question(user_question, chatbot, audio=None):
|
|
| 571 |
|
| 572 |
# email send
|
| 573 |
if len(user_email)>0:
|
| 574 |
-
|
|
|
|
| 575 |
# Send email with the chart image attached
|
| 576 |
-
send_email_with_attachment(
|
| 577 |
recipient_email=user_email,
|
| 578 |
subject="Warehouse Inventory Report",
|
| 579 |
body=response.get("output", "").split(":")[0],
|
|
@@ -581,6 +582,9 @@ def answer_question(user_question, chatbot, audio=None):
|
|
| 581 |
attachment_path=os.getenv("IMAGE_PATH")
|
| 582 |
)
|
| 583 |
|
|
|
|
|
|
|
|
|
|
| 584 |
if "send email to" in user_question:
|
| 585 |
try:
|
| 586 |
os.remove(img) # Clean up the temporary image file
|
|
|
|
| 571 |
|
| 572 |
# email send
|
| 573 |
if len(user_email)>0:
|
| 574 |
+
import asyncio
|
| 575 |
+
|
| 576 |
# Send email with the chart image attached
|
| 577 |
+
coro=send_email_with_attachment(
|
| 578 |
recipient_email=user_email,
|
| 579 |
subject="Warehouse Inventory Report",
|
| 580 |
body=response.get("output", "").split(":")[0],
|
|
|
|
| 582 |
attachment_path=os.getenv("IMAGE_PATH")
|
| 583 |
)
|
| 584 |
|
| 585 |
+
asyncio.run(coro)
|
| 586 |
+
|
| 587 |
+
|
| 588 |
if "send email to" in user_question:
|
| 589 |
try:
|
| 590 |
os.remove(img) # Clean up the temporary image file
|