Spaces:
Running
Running
Update api/data_extractor.py
Browse files- api/data_extractor.py +2 -2
api/data_extractor.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
#from openai import AsyncOpenAI
|
4 |
from pymongo import MongoClient
|
5 |
from openai import OpenAI
|
6 |
-
import os, io
|
7 |
import json
|
8 |
import re
|
9 |
from typing import List, Dict, Any
|
@@ -60,7 +60,7 @@ Your goal will be to extract information from these images to populate the schem
|
|
60 |
image_message = [
|
61 |
{
|
62 |
"type": "image",
|
63 |
-
"image": {"bytes":
|
64 |
}
|
65 |
for uploaded_file in valid_image_files
|
66 |
]
|
|
|
3 |
#from openai import AsyncOpenAI
|
4 |
from pymongo import MongoClient
|
5 |
from openai import OpenAI
|
6 |
+
import os, io, base64
|
7 |
import json
|
8 |
import re
|
9 |
from typing import List, Dict, Any
|
|
|
60 |
image_message = [
|
61 |
{
|
62 |
"type": "image",
|
63 |
+
"image": {"bytes": base64.b64encode(uploaded_file.read()).decode('utf-8')}
|
64 |
}
|
65 |
for uploaded_file in valid_image_files
|
66 |
]
|