Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,9 +44,10 @@ def whatsapp_webhook():
|
|
| 44 |
|
| 45 |
# Generate a unique filename
|
| 46 |
filename = f"{uuid.uuid4()}.jpg"
|
|
|
|
| 47 |
try:
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
# Save the image
|
| 52 |
with open(filepath, 'wb') as f:
|
|
@@ -60,7 +61,7 @@ def whatsapp_webhook():
|
|
| 60 |
response_text = "Please specify if you want to detect a pest or a disease."
|
| 61 |
except Exception as e:
|
| 62 |
print(f"Error processing image: {e}")
|
| 63 |
-
response_text =
|
| 64 |
else:
|
| 65 |
response_text = "The attached file is not an image. Please send an image for classification."
|
| 66 |
elif 'bookkeeping' in incoming_msg:
|
|
|
|
| 44 |
|
| 45 |
# Generate a unique filename
|
| 46 |
filename = f"{uuid.uuid4()}.jpg"
|
| 47 |
+
filepath = os.path.join(UPLOAD_FOLDER, filename)
|
| 48 |
try:
|
| 49 |
|
| 50 |
+
|
| 51 |
|
| 52 |
# Save the image
|
| 53 |
with open(filepath, 'wb') as f:
|
|
|
|
| 61 |
response_text = "Please specify if you want to detect a pest or a disease."
|
| 62 |
except Exception as e:
|
| 63 |
print(f"Error processing image: {e}")
|
| 64 |
+
response_text = filepath
|
| 65 |
else:
|
| 66 |
response_text = "The attached file is not an image. Please send an image for classification."
|
| 67 |
elif 'bookkeeping' in incoming_msg:
|