Update app.py
Browse files
app.py
CHANGED
|
@@ -184,34 +184,52 @@ async def request_gpt4o_completion(image_id: str, user_credit: int, use_gpt4: bo
|
|
| 184 |
messages=[
|
| 185 |
{
|
| 186 |
"role": "system",
|
| 187 |
-
"content": """You are
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
},
|
| 211 |
{
|
| 212 |
"role": "user",
|
| 213 |
"content": [
|
| 214 |
-
{"type": "text", "text": "
|
| 215 |
{
|
| 216 |
"type": "image_url",
|
| 217 |
"image_url": {
|
|
@@ -723,7 +741,7 @@ async def update_user_sheets_and_folders(user_data, transaction_ref, transaction
|
|
| 723 |
business_card_sheet_headers,
|
| 724 |
add_link=True,
|
| 725 |
image_id=image_id,
|
| 726 |
-
link_text="๋ช
|
| 727 |
link_position=-1 # Link at the end
|
| 728 |
)
|
| 729 |
await update_user_sheet(user_data['gDrive_metadata']['spreadsheet'], "๋ช
ํจ", business_cards_data)
|
|
|
|
| 184 |
messages=[
|
| 185 |
{
|
| 186 |
"role": "system",
|
| 187 |
+
"content": """You are a receipt and business card data extractor. Extract information EXACTLY in the specified format.
|
| 188 |
+
|
| 189 |
+
For receipts, follow this EXACT format and order:
|
| 190 |
+
1. "๋ฐํ์ผ": Must be in format "M/D/YYYY HH:MM:SS"
|
| 191 |
+
2. "์ํธ": Store/business name only
|
| 192 |
+
3. "์ฌ์
์๋ฒํธ": Must be in format "###-##-#####" (if present)
|
| 193 |
+
4. "ํฉ๊ณ๊ธ์ก": Total amount with comma for thousands (e.g., "4,300")
|
| 194 |
+
5. "๋ด์ญ": List items with format "item price quantity" (e.g., "๋ณดํต 7g 10ํต 430 4,300")
|
| 195 |
+
6. "์นด๋๋ฒํธ": Must include asterisks for hidden numbers (e.g., "5286-6420-****-077")
|
| 196 |
+
7. "์นด๋์ข
๋ฅ": Card type only
|
| 197 |
+
8. "์น์ธ๋ฒํธ": Approval number only
|
| 198 |
+
9. "๊ธฐํ": All remaining information as key-value pairs separated by commas
|
| 199 |
+
|
| 200 |
+
Example receipt:
|
| 201 |
+
{
|
| 202 |
+
"receipts": [{
|
| 203 |
+
"๋ฐํ์ผ": "3/6/2024 15:31:00",
|
| 204 |
+
"์ํธ": "์ํฅ๋ฐฐ๊ณง๋์ฐ์ฒด๊ตญ",
|
| 205 |
+
"์ฌ์
์๋ฒํธ": "101-83-02925",
|
| 206 |
+
"ํฉ๊ณ๊ธ์ก": "4,300",
|
| 207 |
+
"๋ด์ญ": "๋ณดํต 7g 10ํต 430 4,300",
|
| 208 |
+
"์นด๋๋ฒํธ": "5286-6420-****-077",
|
| 209 |
+
"์นด๋์ข
๋ฅ": "NH๊ธฐ์
์ฒดํฌ",
|
| 210 |
+
"์น์ธ๋ฒํธ": "49980444",
|
| 211 |
+
"๊ธฐํ": "์ ํ: 031-8042-2047, ์ฃผ์: ๊ฒฝ๊ธฐ๋ ์ํฅ์ ์ ์๋ 2543, ๊ณ ๊ฐ๋ฌธ์ ์ ํ: 1588-1300"
|
| 212 |
+
}],
|
| 213 |
+
"busi_cards": []
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
For business cards, follow this EXACT format and order:
|
| 217 |
+
1. "์ด๋ฆ": Full name
|
| 218 |
+
2. "ํ์ฌ๋ช
": Company name
|
| 219 |
+
3. "์์ ๋ฐ ์ง์": Position and department
|
| 220 |
+
4. "์ฃผ์": Address with postal code in format "์ฃผ์ (์ฐํธ๋ฒํธ) ์ฝ๋"
|
| 221 |
+
5. "์ ํ": Office phone with hyphens
|
| 222 |
+
6. "ํด๋ํฐ": Mobile with hyphens (e.g., "010-0000-0000")
|
| 223 |
+
7. "ํฉ์ค": Fax number with hyphens
|
| 224 |
+
8. "e-mail": Email address
|
| 225 |
+
9. "ํํ์ด์ง": Website URL
|
| 226 |
+
|
| 227 |
+
Output must be valid JSON with "receipts" and "busi_cards" arrays."""
|
| 228 |
},
|
| 229 |
{
|
| 230 |
"role": "user",
|
| 231 |
"content": [
|
| 232 |
+
{"type": "text", "text": "Extract the information from this image following the exact format specified."},
|
| 233 |
{
|
| 234 |
"type": "image_url",
|
| 235 |
"image_url": {
|
|
|
|
| 741 |
business_card_sheet_headers,
|
| 742 |
add_link=True,
|
| 743 |
image_id=image_id,
|
| 744 |
+
link_text="๋ช
๏ฟฝ๏ฟฝ๏ฟฝ๋ณด๊ธฐ",
|
| 745 |
link_position=-1 # Link at the end
|
| 746 |
)
|
| 747 |
await update_user_sheet(user_data['gDrive_metadata']['spreadsheet'], "๋ช
ํจ", business_cards_data)
|