Spaces:
Sleeping
Sleeping
Update services/utils.py
Browse files- services/utils.py +4 -3
services/utils.py
CHANGED
@@ -66,7 +66,7 @@ def strcuture_document_data(raw_text:str)->dict:
|
|
66 |
|
67 |
doc_query= (
|
68 |
"""Your primary goal is to take my receipt OCR text and then return back a parsable json.
|
69 |
-
Below is the receipt OCR: \n"""+raw_text +"\n"+"the response should only be in JSON format very Strictly and it should have these keys brand , total_cost , location
|
70 |
|
71 |
|
72 |
)
|
@@ -78,13 +78,14 @@ def strcuture_document_data(raw_text:str)->dict:
|
|
78 |
input_variables=["query"],
|
79 |
partial_variables={"format_instructions": parser.get_format_instructions()},
|
80 |
)
|
81 |
-
|
|
|
82 |
input = prompt.format_prompt(query=doc_query)
|
83 |
with get_openai_callback() as cb:
|
84 |
result = model(input.to_string())
|
85 |
|
86 |
|
87 |
-
|
88 |
# result = extract_json_from_string(result)
|
89 |
# print(f"Formatted Response : {result}")
|
90 |
|
|
|
66 |
|
67 |
doc_query= (
|
68 |
"""Your primary goal is to take my receipt OCR text and then return back a parsable json.
|
69 |
+
Below is the receipt OCR: \n"""+raw_text +"\n"+"the response should only be in JSON format very Strictly and it should have these keys brand , total_cost , location, purchase_category,brand_category , Date , very Strictly."
|
70 |
|
71 |
|
72 |
)
|
|
|
78 |
input_variables=["query"],
|
79 |
partial_variables={"format_instructions": parser.get_format_instructions()},
|
80 |
)
|
81 |
+
print("parser.get_format_instructions()")
|
82 |
+
print(parser.get_format_instructions())
|
83 |
input = prompt.format_prompt(query=doc_query)
|
84 |
with get_openai_callback() as cb:
|
85 |
result = model(input.to_string())
|
86 |
|
87 |
|
88 |
+
print(f"GPT Response {result}")
|
89 |
# result = extract_json_from_string(result)
|
90 |
# print(f"Formatted Response : {result}")
|
91 |
|