cutiee82 commited on
Commit
c7ad52e
·
verified ·
1 Parent(s): cdb4cfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -17,8 +17,7 @@ def image_to_base64(image):
17
 
18
  def caption(image, prompt):
19
  image = image_to_base64(image)
20
- out = ""
21
- for chunk in client.chat.completions.create(
22
  model="openai-large",
23
  messages=[
24
  {
@@ -32,11 +31,8 @@ def caption(image, prompt):
32
  ]
33
  }
34
  ],
35
- max_tokens=1024,
36
- stream=True
37
- ):
38
- out += chunk.choices[0].delta.content
39
- yield out
40
 
41
  gr.Interface(
42
  caption,
 
17
 
18
  def caption(image, prompt):
19
  image = image_to_base64(image)
20
+ return client.chat.completions.create(
 
21
  model="openai-large",
22
  messages=[
23
  {
 
31
  ]
32
  }
33
  ],
34
+ max_tokens=1024
35
+ ).choices[0].message.content
 
 
 
36
 
37
  gr.Interface(
38
  caption,