Spaces:
Runtime error
Runtime error
Onur Savas
commited on
Commit
•
7bab241
1
Parent(s):
c9dff95
added korean
Browse files
main.py
CHANGED
@@ -10,6 +10,7 @@ ocr_en = PaddleOCR(use_angle_cls=True, lang="en")
|
|
10 |
ocr_ch = PaddleOCR(use_angle_cls=True, lang='ch')
|
11 |
ocr_ru = PaddleOCR(use_angle_cls=True, lang='cyrillic')
|
12 |
ocr_ar = PaddleOCR(use_angle_cls=True, lang='arabic')
|
|
|
13 |
#ocr_ch = PaddleOCR(det_model_dir="models/det/ch/ch_PP-OCRv4_det_infer", rec_model_dir="models/rec/ch/ch_PP-OCRv4_rec_infer", cls_model_dir="models/cls/ch_ppocr_mobile_v2.0_cls_infer", rec_char_dict_path="models/dict/ppocr_keys_v1.txt", lang="ch")
|
14 |
|
15 |
|
@@ -24,6 +25,8 @@ def perform_ocr(img, lang):
|
|
24 |
ocr = ocr_ru
|
25 |
elif lang == "Arabic" or lang == "Persian":
|
26 |
ocr = ocr_ar
|
|
|
|
|
27 |
|
28 |
result = ocr.ocr(img, cls=True)
|
29 |
final_result = ""
|
@@ -43,7 +46,7 @@ with demo:
|
|
43 |
with gr.Row():
|
44 |
with gr.Column():
|
45 |
input_image = gr.Image(source="upload", type="filepath")
|
46 |
-
input_radio = gr.Radio(["English", "Chinese (Simplified)", "Russian", "Ukrainian", "Arabic", "Persian"], label="Languages")
|
47 |
input_button = gr.Button("Run!")
|
48 |
with gr.Column():
|
49 |
output_image = gr.Image()
|
|
|
10 |
ocr_ch = PaddleOCR(use_angle_cls=True, lang='ch')
|
11 |
ocr_ru = PaddleOCR(use_angle_cls=True, lang='cyrillic')
|
12 |
ocr_ar = PaddleOCR(use_angle_cls=True, lang='arabic')
|
13 |
+
ocr_korean = PaddleOCR(user_angle_cls=True, lang="korean")
|
14 |
#ocr_ch = PaddleOCR(det_model_dir="models/det/ch/ch_PP-OCRv4_det_infer", rec_model_dir="models/rec/ch/ch_PP-OCRv4_rec_infer", cls_model_dir="models/cls/ch_ppocr_mobile_v2.0_cls_infer", rec_char_dict_path="models/dict/ppocr_keys_v1.txt", lang="ch")
|
15 |
|
16 |
|
|
|
25 |
ocr = ocr_ru
|
26 |
elif lang == "Arabic" or lang == "Persian":
|
27 |
ocr = ocr_ar
|
28 |
+
elif lang == "Korean":
|
29 |
+
ocr = ocr_korean
|
30 |
|
31 |
result = ocr.ocr(img, cls=True)
|
32 |
final_result = ""
|
|
|
46 |
with gr.Row():
|
47 |
with gr.Column():
|
48 |
input_image = gr.Image(source="upload", type="filepath")
|
49 |
+
input_radio = gr.Radio(["English", "Chinese (Simplified)", "Russian", "Ukrainian", "Arabic", "Persian"], label="Languages")
|
50 |
input_button = gr.Button("Run!")
|
51 |
with gr.Column():
|
52 |
output_image = gr.Image()
|