Overview# I built a Gradio App using NDL Kotenseki OCR-Lite .
You can try it at the following URL.
https://huggingface.co/spaces/nakamura196/ndlkotenocr-lite
“NDL Kotenseki OCR-Lite” provides a desktop application, so an execution environment is available without the need for a web app like Gradio.
Therefore, the intended use cases for this web app include usage from smartphones or tablets, and integration via web API.
Development Notes and Bug Fixes# Using Submodules# The original ndlkotenocr-lite was introduced as a submodule.
[ s p u u a r b t l m h o = d = u h l n t e d t l p " k s n o : d t / l e / k n g o o i t c t e r h n - u o l b c i . r t c - e o l m i / t n e d " l ] - l a b / n d l k o t e n o c r - l i t e . g i t
The following is executed during the build.
# # g g ! i i / I t t b n i i s s n t u u / i b b b a m m a l o o s i d d h z u u e l l e e a n u u d p p d d u a a p t t d e e a t e - - i r s n e u i m b t o m t o e d - u r l e e c u r s i v e This should allow the latest files from the original ndlkotenocr-lite to be used during the build.
(There may be some misunderstandings on my part.)
Using Dockerfile# For using the submodule, a Dockerfile-based build approach was adopted.
By setting the sdk to docker, the build is performed based on the Dockerfile.
t e c c s p C i m o o d i h t o l l k n e l j o o : n c e i r r e k : : F T d d r o o : o N ๐ o : c u D m k f t L : b e a l r l t K r u s h o e e e e t d e c n o s n e f k i i g u O r C a R t - i L o i n t e r e G f r e a r d e i n o c e A p a p t h t t p s : / / h u g g i n g f a c e . c o / d o c s / h u b / s p a c e s - c o n f i g - r e f e r e n c e Using Gradio Version 4.44.1# Initially, Gradio version 5.7.1 was used, but the following error occurred when attempting to use the API (described later).
V a l u e E r r o r : C o u l d n o t f e t c h a p i i n f o f o r h t t p s : / / n a k a m u r a 1 9 6 - n d l k o t e n o c r - l i t e . h f . s p a c e / : { " d e t a i l " : " N o t F o u n d " }
By using version 4.44.1, this error was resolved.
API Usage# Below is an example using “The Tale of Genji” (University of Tokyo General Library).
f c r p r l e r o i s i a i m e u m p n n l a i t g t t g _ ( r e n r a = = _ a e d p m s i C c a e u o l l t = l _ i i h " t c e e = / ) l n n h p i t t a r e ( . n e n " p d d t h r l i t e e c i t d _ t m p i f " p s c i o : t l r / ( e t / ( n ' C a h l k t i a t e m p n u s t r : , a / 1 / h 9 i a 6 i n - i d n f l d . e l d _ k l f o . i t i l e t e n c o . c u r - - t l o i k t y e o . . h a f c . . s j p p a / c i e i / i " f ) / g e n j i / T I F F / A 0 0 _ 6 5 8 7 / 0 1 / 0 1 _ 0 0 0 4 . t i f / f u l l / 9 0 0 , / 0 / d e f a u l t . j p g ' ) ,
The following outputs can be obtained: image, text, XML, and JSON data.
' { ใ < ' ' p ใค ? c i ' ' ' r ใ x o { { { { { { { { { m i i i i ใฎ m n ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' g m m m v ๅพก l t [ [ [ i i t i c b i i t i c b i i t i c b i i t i c b i i t i c b i i t i c b i i t i c b i i t i c b i i t i c b i i t i c i g g g a ๆ e 4 4 4 d s e s o o d s e s o o d s e s o o d s e s o o d s e s o o d s e s o o d s e s o o d s e s o o d s e s o o d s e s o n _ _ _ t ใ v n 3 6 6 ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n u ' V x T n f h p n e ใ e t 3 2 2 : e t e f n : e t e f n : e t e f n : e t e f n : e t e f n : e t e f n : e t e f n : e t e f n : e t e f n : e t e f o e a a / ใ r s , , , r ' x i d r ' x i d r ' x i d r ' x i d r ' x i d r ' x i d r ' x i d r ' x i d r ' x i d r ' x i ' i t m v ๅฅณ s ' 0 t : t d i 1 t : t d i 2 t : t d i 3 t : t d i 4 t : t d i 5 t : t d i 6 t : t d i 7 t : t d i 8 t : t d i 9 t : t d : g h e a ไป i : 5 1 5 , i l e n , i l e n , i l e n , i l e n , i l e n , i l e n , i l e n , i l e n , i l e n , i l e h ' ' r ๆด o 3 6 3 c ' i n g c ' i n g c ' i n g c ' i n g c ' i n g c ' i n g c ' i n g c ' i n g c ' i n g c ' i n { t : : / ่กฃ n [ 4 9 4 a ใ n c B a ไธญ n c B a ใ n c B a ใ n c B a ใ n c B a ใฏ n c B a ไบบ n c B a ใ n c B a ใช n c B a ไบบ n c ' ' f ใ = [ ] ] ] l ใค e e o l ใซ e e o l ใ e e o l ใ e e o l ใ e e o l ใพ e e o l ใฎ e e o l ใ e e o l ใ e e o l ใฎ e e i : ' ' o ใพ " { , , ] ' ใ ' ' x ' ใ ' ' x ' ใ ' ' x ' ใ ' ' x ' ใญ ' ' x ' ใ ' ' x ' ๅฟ ' ' x ' ใ ' ' x ' ใ ' ' x ' ใ ' ' m d d l ใ 1 ' , : ใฎ : : ' : ใจ : : ' : ็ตฆ : : ' : ็ตฆ : : ' : ใฟ : : ' : ใฆ : : ' : ใ : : ' : ใจ : : ' : ใ : : ' : ใ : : g 6 e e d ใ . b ๅพก : ใ : ใต : ใธ : ๆง : ใ : ใ : ใ : ใ : ใ _ 7 f f e ใต 0 o ' ๆ ' 0 ' ใ ' 0 ' ใ ' 0 ' ใ ' 0 ' ใ ' 0 ' ใ ' 0 ' ใ ' 0 ' ใค ' 0 ' ใณ ' 0 ' ใ ' 0 w 6 a a r ใ " u t ใ t . [ t ใ t . [ t ใ t . [ t ๅพก t . [ t ใช t . [ t ใ t . [ t ใ t . [ t ใ t . [ t ใต t . [ t ใ t . i , u u s ใฒ n r ใ r 8 [ r ใจ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 [ r ใ r 8 d l l / ็ตฆ ? d u ใ u 4 4 u ใช u 1 3 u ใ u 1 3 u ใ u 4 3 u ใป u 1 2 u ใ u 3 2 u ใ u 4 2 u ใช u 4 1 u ใ u 3 1 u ใฏ u 4 t t t z ใ > i e ๅฅณ e 5 0 e ใ e 4 7 e ใฏ e 2 4 e ใณ e 1 1 e ใจ e 9 7 e ๆ e 5 4 e ใ e 5 2 e ใ e 2 8 e ใ e } 5 e ใ e 4 h . . 5 ใ \ n ' ไป ' } 1 ' ใ ' } 2 ' ใ ' } 2 ' ใต ' } 2 ' ใ ' } 9 ' ๅค ' } 8 ' ใฟ ' } 0 ' ่ก ' } 9 ' ๅ ' , 8 ' ใ ' } ' j j n g , ๆด , , , , ใฏ , , , , ใ , , , , ใ , , , , ใ , , , , ใฎ , , , , ใ , , , , ใ , , , , ใช , , , ใ , ] : p p 3 n < B ่กฃ ใซ ใ ใ ไธ ๅฎฎ ใ ใฎ ใ ใ ] e e p ไธญ O o ใ 1 ใฏ 1 ใ 1 ใพ 1 ใ 1 ใค 1 ใต 1 ๅฟ 1 ๆฃ 1 ็ตฆ , 9 g g 9 ใซ C x ใพ 6 ใ 6 ๆ 6 ใ 6 ใ 6 ใ 6 ใค 7 ใป 6 ใซ 6 ใฏ 0 ' ' s ใ R ' ใ 9 ใ 3 ใ 2 ใ 9 ใฎ 2 ใธ 2 ใ 0 ใ 2 ใ 9 ใ 0 , } 8 ใจ D : ใ ] ใฌ ] ใจ ] ใ ] ๆด ] ใซ ] ใ ] ใ ] ใป ] ไธ , } m ใ A ใต , ใ , ๆ , ใฎ , ่กฃ , ใค , ใซ , ใซ , ใ , ใฎ ) 0 ใ T [ ใ ใ ใฒ ใซ ใ ใ ใ ใ ใ ใ 1 ใ A [ ใฒ [ ใ [ ' [ ใ [ ใก [ ใฆ [ ใ [ ใจ [ ใฆ [ ใ 1 ใจ S 4 ็ตฆ 4 ใ 3 , 3 ใจ 3 ' 2 ใ 2 ใ 2 ใ 1 ' 1 ใ d ใช E 3 ใ 0 ใ 7 4 ใ 1 , 7 ' 4 ' 2 ใก 8 , 5 ' v ใ T 3 ใ 1 ใจ 2 2 ' 2 9 , 8 , 0 ' 9 8 , 0 ใ > , ' , ' , , , , , , , , , , t ใฏ \ , , j ใซ n 1 5 5 5 5 5 5 5 5 5 t ใฏ \ 6 3 4 4 3 4 4 3 4 3 7 ใ t 9 3 0 0 4 1 0 2 0 2 c ใ < ] ] ] ] ] ] ] ] ] ] h ใฌ P , , , , , , , , , , 2 ใ A 1 ใ G [ [ [ [ [ [ [ [ [ j ใ E 4 3 3 3 3 2 2 2 1 t ใ 3 9 7 3 0 7 4 1 8 m ใ I 0 9 1 9 7 9 7 7 6 h ใจ M , , , , , , , , , 0 \ A 0 n G 1 1 1 1 1 1 1 1 1 0 ใ E 6 6 6 6 6 6 7 6 6 0 ใ N 9 3 2 9 2 2 0 2 9 g ใ A ] ] ] ] ] ] ] ] ] n ็ตฆ M , , , , , , , , , / ใต E T ใ = [ [ [ [ [ [ [ [ [ / ใ " 4 3 3 3 3 2 2 2 1 g ใ d 3 9 7 3 0 7 4 1 8 r ใ e 0 9 1 9 7 9 7 7 6 a ใฏ f , , , , , , , , , d ใ a i ใ u 5 5 5 5 5 5 5 5 5 o ใ l 3 4 4 3 4 4 3 4 3 / ใ t 3 0 0 4 1 0 2 0 2 1 ๆ . ] ] ] ] ] ] ] ] ] 4 ใ j ] ] ] ] ] ] ] ] ] 1 ใจ p , , , , , , , , , 9 ๆ e 0 ใฒ g e \ " a n 2 ใ W 0 ใ I e ใ D 0 ็ตฆ T 0 ใธ H e ใ = 2 ๅพก " 4 ใ 9 f ใ 0 5 ใณ 0 0 ใต " c ใ 0 ใ H b ใพ E a ใ I 0 ใ G f ใ H 1 ใฎ T e ใซ = f ใ " d ใจ 6 9 ใ 7 f \ 6 4 n " 1 ใ > 1 ใ \ 7 ใญ n 4 ใฟ \ 7 ๆง t a ใ \ 6 ใช t b ใ < b ใป L 7 ใจ I f ใ N 9 ใ E f ไธ 4 ใ T 0 ใ Y 6 ใฎ P 7 ๆด E 4 ่กฃ = 0 ใ " 4 ใก ๆฌ d \ ๆ 9 n " 4 ใฏ c ใพ X 1 ใ = f ใฆ " c ใ 4 b ใ 3 6 ใ 3 8 ใ " 1 ใ f ๆ Y 9 ๅค = / ใฎ " i ๅฎฎ 1 m ใค 6 a ใ 9 g ใธ " e ใซ . ใค W w ใ I e ใฆ D b ใ T p \ H ' n = , ไบบ " ใฎ 2 ๅฟ 9 ใ " ใ ใ H ใ E ใ I ใ G ใ H ใฟ T ใ = ใ " ใต 3 ใค 6 ใ 5 ใ " ใซ ใ C ใ O ใ N \ F n = ใ " ใ 0 ใ . ใจ 8 ใ 4 ใค 5 ใ " ใ ใช O ใ R ่ก D ใ E ใฎ R ๅฟ = ใป " ใ 0 ใ " ใซ ใ S ใจ T ใ R ใก I \ N n G ใช = ใ " ใ ใ ใ ใค ใ ใ ใณ ใฎ ใต ๅพก ใ ๆ ใ ใ ใ ใ ๅ ใ ใช ๅฅณ ใ ไป ๆฃ ๆด ใซ ่กฃ ใ ใ ใป ใพ ใ ใ ใ ใ ใฆ ใต \ ใ n ใฒ ไบบ ็ตฆ ใฎ ใ ใ ใ ใ " ใ / ใ > ใ \ ใ n ใฏ \ ใ t ใ \ ใ t ใ < ็ตฆ L ใฏ I ใ N ไธ E ใฎ ใ T ใ Y ใ P ' E , = " ๆฌ ๆ " X = " 4 0 1 " Y = " 1 6 9 " W I D T H = " 2 9 " H E I G H T = " 3 6 4 " C O N F = " 0 . 8 1 4 " O R D E R = " 1 " S T R I N G = " ไธญ ใซ ใ ใจ ใ ใ ใ ใจ ใช ใ ใ ใฏ ใซ ใฏ ใ ใ ใฌ ใ ใ ใ ใ ใ ใจ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 3 7 2 " Y = " 1 6 3 " W I D T H = " 2 7 " H E I G H T = " 3 7 7 " C O N F = " 0 . 8 1 2 " O R D E R = " 2 " S T R I N G = " ใ ใ ใ ็ตฆ ใต ใ ใ ใ ใ ใฏ ใ ใ ใ ใ ๆ ใ ใจ ๆ ใฒ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 3 4 2 " Y = " 1 6 2 " W I D T H = " 2 9 " H E I G H T = " 3 7 8 " C O N F = " 0 . 8 4 1 " O R D E R = " 3 " S T R I N G = " ใ ใ ใ ็ตฆ ใธ ใ ๅพก ใ ใ ใณ ใต ใ ใ ใพ ใ ใ ใ ใฎ ใซ ใ ใจ ใ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 3 1 2 " Y = " 1 6 9 " W I D T H = " 2 7 " H E I G H T = " 3 6 5 " C O N F = " 0 . 8 1 9 " O R D E R = " 4 " S T R I N G = " ใ ใ ใญ ใฟ ๆง ใ ใช ใ ใป ใจ ใ ใ ไธ ใ ใ ใฎ ๆด ่กฃ ใ ใก " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 2 7 9 " Y = " 1 6 2 " W I D T H = " 2 8 " H E I G H T = " 3 7 9 " C O N F = " 0 . 8 3 5 " O R D E R = " 5 " S T R I N G = " ใฏ ใพ ใ ใฆ ใ ใ ใ ใ ใ ๆ ๅค ใฎ ๅฎฎ ใค ใ ใธ ใซ ใค ใ ใฆ ใ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 2 4 8 " Y = " 1 6 2 " W I D T H = " 3 1 " H E I G H T = " 3 7 8 " C O N F = " 0 . 8 4 5 " O R D E R = " 6 " S T R I N G = " ไบบ ใฎ ๅฟ ใ ใ ใ ใ ใ ใ ใ ใฟ ใ ใ ใต ใค ใ ใ ใซ ใ ใ ใ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 2 2 0 " Y = " 1 7 0 " W I D T H = " 2 7 " H E I G H T = " 3 6 2 " C O N F = " 0 . 8 4 2 " O R D E R = " 7 " S T R I N G = " ใ ใ ใ ใจ ใ ใค ใ ใ ใช ใ ่ก ใ ใฎ ๅฟ ใป ใ ใ ใซ ใ ใจ ใ ใก " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 1 8 9 " Y = " 1 6 2 " W I D T H = " 2 8 " H E I G H T = " 3 7 8 " C O N F = " 0 . 8 3 0 " O R D E R = " 8 " S T R I N G = " ใช ใ ใ ใ ใ ใณ ใต ใ ใ ใ ๅ ใช ใ ๆฃ ใซ ใ ใป ใ ใ ใฆ " / > \ n \ t \ t < L I N E T Y P E = " ๆฌ ๆ " X = " 1 5 8 " Y = " 1 6 9 " W I D T H = " 2 8 " H E I G H T = " 3 6 3 " C O N F = " 0 . 8 4 4 " O R D E R = " 9 " S T R I N G = " ไบบ ใฎ ใ ใ ใ ใ ใ ใ ใฏ ใ ใ ใ ใ ็ตฆ ใฏ ใ ไธ ใฎ ใ ใ ใ " / > \ n \ t < / P A G E > \ n < / O C R D A T A S E T > \ n ' , Development# The repository includes a docker-compose.yml, so it can be used for building development environments and deploying to production environments outside of HuggingFace Spaces.
Summary# I am grateful that “NDL Kotenseki OCR-Lite” was released as OSS.
I may be unfamiliar with Docker-based development and there may be inaccuracies, but I hope this serves as a helpful reference.