Skip to content

Commit 16886b5

Browse files
authored
Update espcams3openai.py
1 parent f5093c8 commit 16886b5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ESP32/espcams3openai.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def send_image_to_chatgpt(image_data, api_key):
8989
url = "https://api.openai.com/v1/chat/completions"
9090

9191
# Bild in Base64 umwandeln
92-
image_base64 = ubinascii.b2a_base64(image_data).strip().decode()
93-
92+
image_base64 = ubinascii.b2a_base64(image_data).decode().replace("\n", "")
93+
9494
# JSON-Body für ChatGPT Vision
9595
data = {
9696
"model": "gpt-4o-mini", # Kleiner, schneller Vision-geeigneter GPT
@@ -100,7 +100,7 @@ def send_image_to_chatgpt(image_data, api_key):
100100
"content": [
101101
{
102102
"type": "text",
103-
"text": "Lese den Zählerstand ab, es müssen 6 Stellen vor dem Komma sein. Gib das Ergebnis als Zahl aus, keine zusätzlichen Worte oder Zeichen!"
103+
"text": "Erhöhe den Kontrast des Bildes. Verringere das Gamma in dem Bild. Negiere das Bild. Dann lese den Zählerstand ab, es müssen 6 Stellen vor dem Komma sein. Gib das Ergebnis als Zahl aus, keine zusätzlichen Worte oder Zeichen!"
104104
},
105105
{
106106
"type": "image_url",
@@ -315,7 +315,7 @@ def send_image_to_ai_proxy(image_data):
315315
except Exception as e:
316316
print("Fehler in Main:", e)
317317
time.sleep(3600)
318-
continue
318+
machine.reset()
319319

320320
if stand_int > last_reading:
321321
send_mqtt(str(stand_int))

0 commit comments

Comments
 (0)