Spaces:
Running
Running
vteam27
commited on
Commit
•
fe10d73
1
Parent(s):
8b21536
added examples,file download, lfs
Browse files- .gitattributes +2 -0
- Examples/Book.png +3 -0
- Examples/Files.jpg +3 -0
- Examples/Manuscript.jpg +3 -0
- Examples/News.png +3 -0
- app.py +19 -3
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
Examples/Book.png
ADDED
Git LFS Details
|
Examples/Files.jpg
ADDED
Git LFS Details
|
Examples/Manuscript.jpg
ADDED
Git LFS Details
|
Examples/News.png
ADDED
Git LFS Details
|
app.py
CHANGED
@@ -23,8 +23,24 @@ def greet(img):
|
|
23 |
res=res + " " + obj3.value
|
24 |
res=res + "\n"
|
25 |
res=res + "\n"
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
demo = gr.Interface(fn=greet,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
demo.launch()
|
|
|
23 |
res=res + " " + obj3.value
|
24 |
res=res + "\n"
|
25 |
res=res + "\n"
|
26 |
+
_output_name = "RESULT_OCR.txt"
|
27 |
+
open(_output_name, 'w').close() # clear file
|
28 |
+
with open(_output_name, "w", encoding="utf-8", errors="ignore") as f:
|
29 |
+
f.write(res)
|
30 |
+
print("Writing into file")
|
31 |
+
return res, _output_name
|
32 |
|
33 |
+
demo = gr.Interface(fn=greet,
|
34 |
+
inputs=gr.Image(type="pil"),
|
35 |
+
outputs=["text", "file"],
|
36 |
+
title=title,
|
37 |
+
description=description
|
38 |
+
examples=[
|
39 |
+
["Examples\Book.png"],
|
40 |
+
["Examples\News.png"],
|
41 |
+
["Examples\Manuscript.jpg"],
|
42 |
+
["Examples\Files.jpg"],
|
43 |
+
],
|
44 |
+
)
|
45 |
|
46 |
+
demo.launch(debug=True)
|