Spaces:
Sleeping
Sleeping
Update receipt_gen_agent.py
Browse files- receipt_gen_agent.py +9 -9
receipt_gen_agent.py
CHANGED
|
@@ -28,7 +28,7 @@ from os.path import isfile, join
|
|
| 28 |
|
| 29 |
class State(TypedDict):
|
| 30 |
prompt: str
|
| 31 |
-
image_number: int
|
| 32 |
image_data: json
|
| 33 |
image_byte: list[str]
|
| 34 |
eval: dict
|
|
@@ -254,18 +254,18 @@ class receipt_agent:
|
|
| 254 |
def receipt_gen(self, images):
|
| 255 |
config = {"configurable": {"thread_id": "1"}}
|
| 256 |
|
| 257 |
-
data_list = [f for f in listdir('new_receipt_data') if isfile(join('new_receipt_data', f))]
|
| 258 |
-
if not data_list:
|
| 259 |
-
|
| 260 |
-
else:
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
|
| 265 |
response = self.agent.invoke({
|
| 266 |
'prompt': 'analyse this receipt and list the items, return a json',
|
| 267 |
'n_retries': 0,
|
| 268 |
-
'image_number': len(data_list),
|
| 269 |
'image_byte': images # Now passing the list of images directly
|
| 270 |
}, config)
|
| 271 |
|
|
|
|
| 28 |
|
| 29 |
class State(TypedDict):
|
| 30 |
prompt: str
|
| 31 |
+
# image_number: int
|
| 32 |
image_data: json
|
| 33 |
image_byte: list[str]
|
| 34 |
eval: dict
|
|
|
|
| 254 |
def receipt_gen(self, images):
|
| 255 |
config = {"configurable": {"thread_id": "1"}}
|
| 256 |
|
| 257 |
+
# data_list = [f for f in listdir('new_receipt_data') if isfile(join('new_receipt_data', f))]
|
| 258 |
+
# if not data_list:
|
| 259 |
+
# data_list=[]
|
| 260 |
+
# else:
|
| 261 |
+
# with open(f'new_receipt_data/{data_list[0]}', 'r') as openfile:
|
| 262 |
+
# # Reading from json file
|
| 263 |
+
# data_list = json.load(openfile)
|
| 264 |
|
| 265 |
response = self.agent.invoke({
|
| 266 |
'prompt': 'analyse this receipt and list the items, return a json',
|
| 267 |
'n_retries': 0,
|
| 268 |
+
# 'image_number': len(data_list),
|
| 269 |
'image_byte': images # Now passing the list of images directly
|
| 270 |
}, config)
|
| 271 |
|