Update app.py
Browse files
app.py
CHANGED
|
@@ -27,21 +27,25 @@ def save_image():
|
|
| 27 |
}
|
| 28 |
|
| 29 |
payload = {
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
{
|
| 33 |
-
|
| 34 |
-
|
| 35 |
},
|
| 36 |
{
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
"image": f"data:image/png;base64,{base64_image}"
|
| 41 |
-
}
|
| 42 |
}
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
| 46 |
|
| 47 |
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
payload = {
|
| 30 |
+
"model": "gpt-4o",
|
| 31 |
+
"messages": [
|
| 32 |
+
{
|
| 33 |
+
"role": "user",
|
| 34 |
+
"content": [
|
| 35 |
{
|
| 36 |
+
"type": "text",
|
| 37 |
+
"text": "์ด๋ฏธ์ง๋ฅผ ์
๋ ฅ๋ฐ์ผ๋ฉด ๋น๋ฅ๊ฐ ๋ช g์ธ์ง ์์์ ๊ฐ์ ํ์๋ง ์ถ๋ ฅํ์์ค.\n์) ๋น๋ฅ : 10g \n์ํ๋ถ์ํ๊ฐ ์๋๋ผ๋ฉด 'error'๋ฅผ ์ถ๋ ฅํ์์ค."
|
| 38 |
},
|
| 39 |
{
|
| 40 |
+
"type": "image_url",
|
| 41 |
+
"image_url": {
|
| 42 |
+
"url": f"data:image/jpeg;base64,{base64_image}"
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
+
}
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"max_tokens": 300
|
| 49 |
}
|
| 50 |
|
| 51 |
response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload)
|