changxin commited on
Commit
fcd97d5
1 Parent(s): ab4d2f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -55,7 +55,7 @@ def fx5():
55
  return html_code
56
 
57
  def fx6(img, lang):
58
- ocr = PaddleOCR(use_angle_cls=True, lang=lang,use_gpu=False)
59
  img_path = img.name
60
  result = ocr.ocr(img_path, cls=True)
61
  image = Image.open(img_path).convert('RGB')
@@ -98,7 +98,7 @@ with demo:
98
  with gr.TabItem("Excel365测试"):
99
  gr.HTML(value=ht_text,label="在线版演示",show_label=True)
100
  with gr.TabItem("OCR识别"):
101
- ocr_input=[gr.Image(type='file', label='请提供你需要识别的照片'),gr.Dropdown(choices=['ch', 'en', 'fr', 'german', 'korean', 'japan'], type="value", default='ch', label='请选择需要识别的语言')]
102
  ocr_output=gr.Image(type='file', label='识别结果')
103
  ocr_button = gr.Button("开始ocr识别")
104
 
 
55
  return html_code
56
 
57
  def fx6(img, lang):
58
+ ocr = PaddleOCR(use_angle_cls=True, lang={'中文':'ch','英文':'en','法文':'fr','德文':'german','韩文':'korean','日文':'japan'}[lang],use_gpu=False)
59
  img_path = img.name
60
  result = ocr.ocr(img_path, cls=True)
61
  image = Image.open(img_path).convert('RGB')
 
98
  with gr.TabItem("Excel365测试"):
99
  gr.HTML(value=ht_text,label="在线版演示",show_label=True)
100
  with gr.TabItem("OCR识别"):
101
+ ocr_input=[gr.Image(type='file', label='请提供你需要识别的照片'),gr.Dropdown(choices=['中文','英文','法文','德文','韩文','日文'], type="value", default='ch', label='请选择需要识别的语言')]
102
  ocr_output=gr.Image(type='file', label='识别结果')
103
  ocr_button = gr.Button("开始ocr识别")
104