youngtsai commited on
Commit
fed0398
·
1 Parent(s): 214d8e5

model = "gemini-2.5-pro-exp-03-25"

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -2301,13 +2301,27 @@ def extract_text_from_image(image):
2301
  )
2302
 
2303
  # 設定模型和內容
2304
- model = "gemini-2.0-pro-exp-02-05"
2305
  contents = [
2306
  types.Content(
2307
  role="user",
2308
  parts=[
2309
  image_part,
2310
- types.Part.from_text(text="verify the text and return the text only. do not return any other text and check the text is correct or not.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2311
  ]
2312
  )
2313
  ]
 
2301
  )
2302
 
2303
  # 設定模型和內容
2304
+ model = "gemini-2.5-pro-exp-03-25"
2305
  contents = [
2306
  types.Content(
2307
  role="user",
2308
  parts=[
2309
  image_part,
2310
+ types.Part.from_text(text="""
2311
+ 請根據以下影像內容進行中文文字辨識,請注意以下規則:
2312
+ 1. **只輸出辨識出的純中文文字內容**,請勿修正 or 加入額外語句。
2313
+ 2. **請檢查辨識結果是否為合理的中文句子**,如有錯字或難以辨識的部分,請如實呈現原貌。
2314
+ 3. 請判斷此影像中文字為「直式書寫」或「橫式書寫」,若為直式,請判斷為「由右至左」或「由左至右」。
2315
+ 4. 在輸出文字前,請先標示出排版方式,例如:「【橫式|由左至右】」或「【直式|由右至左】」。
2316
+ 5. 若無法辨識排版方向,請回傳:「【排版方向無法辨識】」。
2317
+ 6. 如果有辨識出 title 請回傳 title 在文字最前面,例如:「【橫式|由左至右】\n 標題:我的家」
2318
+ 7. 如果文章內有標點符號,請如實回傳標點符號
2319
+ 8. 如果文章內有換行,請如實回傳換行
2320
+ 9. 如果有作者的名字,請忽略
2321
+ 10. 如果文章內有英文或是注音符號,請如實回傳
2322
+ 11. 如果文章內有數字,請如實回傳
2323
+ 請務必遵守以上規則,不要加入多餘文字或解釋。"""
2324
+ )
2325
  ]
2326
  )
2327
  ]