Update app.py
Browse files
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 |
-
|
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 |
-
|
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,
|