devlim commited on
Commit
4034184
โ€ข
1 Parent(s): 286e460

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -27,21 +27,25 @@ def save_image():
27
  }
28
 
29
  payload = {
30
- "model": "gpt-4",
31
- "messages": [
 
 
 
32
  {
33
- "role": "user",
34
- "content": "์ด๋ฏธ์ง€๋ฅผ ์ž…๋ ฅ๋ฐ›์œผ๋ฉด ๋‹น๋ฅ˜๊ฐ€ ๋ช‡ g์ธ์ง€ ์˜ˆ์‹œ์™€ ๊ฐ™์€ ํ˜•์‹๋งŒ ์ถœ๋ ฅํ•˜์‹œ์˜ค.\n์˜ˆ) ๋‹น๋ฅ˜ : 10g \n์ƒํ’ˆ๋ถ„์„ํ‘œ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด 'error'๋ฅผ ์ถœ๋ ฅํ•˜์‹œ์˜ค."
35
  },
36
  {
37
- "role": "user",
38
- "content": {
39
- "type": "image",
40
- "image": f"data:image/png;base64,{base64_image}"
41
- }
42
  }
43
- ],
44
- "max_tokens": 300
 
 
 
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)