Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -393,19 +393,6 @@ def inventory_report(question):
|
|
| 393 |
# chart = sdf.chat("Can you draw a bar chart with all avaialble item name and quantity.")
|
| 394 |
chart = sdf.chat(question)
|
| 395 |
|
| 396 |
-
# email send
|
| 397 |
-
if user_email:
|
| 398 |
-
# Send email with the chart image attached
|
| 399 |
-
send_email_with_attachment(
|
| 400 |
-
recipient_email=user_email,
|
| 401 |
-
subject="Warehouse Inventory Report",
|
| 402 |
-
body=response.get("output", "").split(":")[0],
|
| 403 |
-
image_data = img_str
|
| 404 |
-
# attachment_path=chart_path
|
| 405 |
-
#attachment_path=os.getenv("IMAGE_PATH")
|
| 406 |
-
)
|
| 407 |
-
|
| 408 |
-
|
| 409 |
return chart
|
| 410 |
|
| 411 |
|
|
@@ -570,8 +557,20 @@ def answer_question(user_question, chatbot, audio=None):
|
|
| 570 |
img = f'<img src="data:image/png;base64,{img_str}" style="width:500px; height:400px;">'
|
| 571 |
# image = gr.Image(value=img_str)
|
| 572 |
chatbot.append((user_question, img))
|
|
|
|
| 573 |
print(user_email)
|
| 574 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 575 |
|
| 576 |
if "send email to" in user_question:
|
| 577 |
try:
|
|
|
|
| 393 |
# chart = sdf.chat("Can you draw a bar chart with all avaialble item name and quantity.")
|
| 394 |
chart = sdf.chat(question)
|
| 395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
return chart
|
| 397 |
|
| 398 |
|
|
|
|
| 557 |
img = f'<img src="data:image/png;base64,{img_str}" style="width:500px; height:400px;">'
|
| 558 |
# image = gr.Image(value=img_str)
|
| 559 |
chatbot.append((user_question, img))
|
| 560 |
+
print("user_email")
|
| 561 |
print(user_email)
|
| 562 |
+
|
| 563 |
+
# email send
|
| 564 |
+
if user_email:
|
| 565 |
+
# Send email with the chart image attached
|
| 566 |
+
send_email_with_attachment(
|
| 567 |
+
recipient_email=user_email,
|
| 568 |
+
subject="Warehouse Inventory Report",
|
| 569 |
+
body=response.get("output", "").split(":")[0],
|
| 570 |
+
image_data = img_str
|
| 571 |
+
# attachment_path=chart_path
|
| 572 |
+
#attachment_path=os.getenv("IMAGE_PATH")
|
| 573 |
+
)
|
| 574 |
|
| 575 |
if "send email to" in user_question:
|
| 576 |
try:
|