m8chaa commited on
Commit
f1403c7
โ€ข
1 Parent(s): 96dce28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -10
app.py CHANGED
@@ -188,17 +188,51 @@ async def request_gpt4o_completion(image_id: str, user_credit: int):
188
 
189
  # Step 4: Prepare the prompt for Gemini
190
  prompt = f'''
191
- Image content: {extracted_text}
192
-
193
- Please analyze the above text extracted from an image and perform the following tasks:
194
- 1. Identify if the image contains receipts or business cards.
195
- 2. For each receipt found, extract the following information: {', '.join(receipt_sheet_headers)}
196
- 3. For each business card found, extract the following information: {', '.join(business_card_sheet_headers)}
197
- 4. Format the extracted information as a JSON object with two main keys: 'receipts' and 'busi_cards'.
198
- 5. Each key should contain an array of objects, where each object represents a single receipt or business card.
199
- 6. Ensure the total number of receipts and business cards combined does not exceed 500.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
- Please provide the response in valid JSON format.
202
  '''
203
  logging.info("Prompt prepared for Gemini model: " + prompt)
204
 
 
188
 
189
  # Step 4: Prepare the prompt for Gemini
190
  prompt = f'''
191
+ #Direction
192
+ You are an employee of finance department of a company. For each task well done, you will be rewarded $1,000 bonus.
193
+ The boss has come to your office and gave you a task of transfering the content of receipts and business cards onto a google spreadsheet.
194
+ He hands you two things.
195
+ One, is a paper containing guideline and example.
196
+ Two, is an OCR text.
197
+
198
+ #Guideline
199
+ -strictly adhere to the given content of OCR text.
200
+ -it could be of receipt(s) or business card(s) but not both
201
+ -any other info that couldn't be classified is sorted into "๊ธฐํƒ€"
202
+
203
+ #Example
204
+ ##Receipts
205
+ Input
206
+
207
+ Output
208
+ -๋ฐœํ–‰์ผ: 2024/02/23 20:10
209
+ -์ƒํ˜ธ: ์€์„ฑ๋งˆ์ผ“
210
+ -์‚ฌ์—…์ž๋ฒˆํ˜ธ: 727-27-01455
211
+ -ํ•ฉ๊ณ„๊ธˆ์•ก: 2,800์›
212
+ -๋‚ด์—ญ:
213
+ ๋Šํƒ€๋ฆฌ๋ฒ„์„ฏ 1,000์› 1๊ฐœ
214
+ ์–‘๋ฐฐ์ถ” 1,800์› 1๊ฐœ
215
+ -์นด๋“œ๋ฒˆํ˜ธ: 4673-09**-****-515*
216
+ -์นด๋“œ์ข…๋ฅ˜: KB๊ตญ๋ฏผ์ฒดํฌ
217
+ -์Šน์ธ๋ฒˆํ˜ธ: 30014507
218
+ -๊ธฐํƒ€:
219
+
220
+ ##Business Cards
221
+ Input
222
+
223
+ Output
224
+ -์ด๋ฆ„: ๋ฐ•์žฅ์›
225
+ -ํšŒ์‚ฌ๋ช…: ์•„์ดํ”„๋ฆฌ๋งˆ
226
+ -์†Œ์† ๋ฐ ์ง์œ„: ๋Œ€ํ‘œ
227
+ -์ฃผ์†Œ: ๊ฒฝ๊ธฐ๋„ ํ™”์„ฑ์‹œ ์ •๋‚จ๋ฉด ๋งŒ๋…„๋กœ 98๋ฒˆ๊ธธ 55 (์šฐํŽธ๋ฒˆํ˜ธ) 18523
228
+ -์ „ํ™”: (031) 000-0000
229
+ -ํœด๋Œ€ํฐ: (031) 000-0000
230
+ -ํŒฉ์Šค: 010-0000-0000
231
+ -e-mail: iprima@gmail.com
232
+ -ํ™ˆํŽ˜์ด์ง€: www.sol2u.co.kr
233
+ -๊ธฐํƒ€:
234
 
235
+ Image content: {extracted_text}
236
  '''
237
  logging.info("Prompt prepared for Gemini model: " + prompt)
238