Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -145,9 +145,18 @@ def handle_image_message(event):
|
|
| 145 |
# ε²εηΆεζεθ¨ζ―
|
| 146 |
user_text = event.message.text
|
| 147 |
store_user_message(user_id, "text", user_text)
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
|
| 152 |
else:
|
| 153 |
global working_status
|
|
|
|
| 145 |
# ε²εηΆεζεθ¨ζ―
|
| 146 |
user_text = event.message.text
|
| 147 |
store_user_message(user_id, "text", user_text)
|
| 148 |
+
|
| 149 |
+
try:
|
| 150 |
+
# η’ΊδΏεηεε¨
|
| 151 |
+
if not os.path.exists(image_path):
|
| 152 |
+
raise FileNotFoundError(f"εηθ·―εΎη‘ζοΌ{image_path}")
|
| 153 |
+
|
| 154 |
+
organ = PIL.Image.open(image_path)
|
| 155 |
+
completion = chat.send_message([user_text, organ])
|
| 156 |
+
out = completion.text
|
| 157 |
+
|
| 158 |
+
except Exception as e:
|
| 159 |
+
out = f"ηΌηι―θͺ€: {e}"
|
| 160 |
|
| 161 |
else:
|
| 162 |
global working_status
|