Update
Browse files- README.md +1 -1
- app.py +20 -11
- requirements.txt +2 -2
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: π
|
|
4 |
colorFrom: blue
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
4 |
colorFrom: blue
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.36.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
app.py
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
5 |
-
import functools
|
6 |
import os
|
7 |
import pathlib
|
8 |
import urllib.request
|
@@ -24,26 +23,36 @@ def download_sample_images() -> list[pathlib.Path]:
|
|
24 |
return sorted(image_dir.rglob("*.jpg"))
|
25 |
|
26 |
|
27 |
-
|
28 |
-
return mocr(image)
|
29 |
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
examples =
|
36 |
|
37 |
with gr.Blocks(css="style.css") as demo:
|
38 |
gr.Markdown(DESCRIPTION)
|
39 |
with gr.Row():
|
40 |
with gr.Column():
|
41 |
image = gr.Image(label="Input", type="pil")
|
42 |
-
run_button = gr.Button(
|
43 |
with gr.Column():
|
44 |
result = gr.Text(label="Output")
|
45 |
gr.Examples(
|
46 |
-
examples=examples,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
)
|
48 |
-
|
49 |
-
|
|
|
|
|
|
2 |
|
3 |
from __future__ import annotations
|
4 |
|
|
|
5 |
import os
|
6 |
import pathlib
|
7 |
import urllib.request
|
|
|
23 |
return sorted(image_dir.rglob("*.jpg"))
|
24 |
|
25 |
|
26 |
+
mocr = MangaOcr()
|
|
|
27 |
|
28 |
|
29 |
+
def run(image: PIL.Image.Image) -> str:
|
30 |
+
return mocr(image)
|
31 |
|
32 |
+
|
33 |
+
examples = download_sample_images()
|
34 |
|
35 |
with gr.Blocks(css="style.css") as demo:
|
36 |
gr.Markdown(DESCRIPTION)
|
37 |
with gr.Row():
|
38 |
with gr.Column():
|
39 |
image = gr.Image(label="Input", type="pil")
|
40 |
+
run_button = gr.Button()
|
41 |
with gr.Column():
|
42 |
result = gr.Text(label="Output")
|
43 |
gr.Examples(
|
44 |
+
examples=examples,
|
45 |
+
inputs=image,
|
46 |
+
outputs=result,
|
47 |
+
fn=run,
|
48 |
+
)
|
49 |
+
run_button.click(
|
50 |
+
fn=run,
|
51 |
+
inputs=image,
|
52 |
+
outputs=result,
|
53 |
+
api_name="run",
|
54 |
)
|
55 |
+
|
56 |
+
|
57 |
+
if __name__ == "__main__":
|
58 |
+
demo.queue().launch()
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
manga_ocr==0.1.
|
2 |
-
Pillow==
|
|
|
1 |
+
manga_ocr==0.1.11
|
2 |
+
Pillow==10.3.0
|