Luke
commited on
Commit
·
765cf0f
1
Parent(s):
a60d0d2
no message
Browse files
Plan/pytesseractJsOCR.py
CHANGED
|
@@ -9,7 +9,7 @@ def pytesseractJs_recognition(validation_type, image, temp_path, file_name, lang
|
|
| 9 |
try:
|
| 10 |
# 使用 subprocess 執行 JavaScript 代碼,傳遞語言參數
|
| 11 |
result = subprocess.run(
|
| 12 |
-
['node', 'pytesseractJsOCR.js', image, language, temp_path + file_name],
|
| 13 |
capture_output=True,
|
| 14 |
text=True
|
| 15 |
)
|
|
|
|
| 9 |
try:
|
| 10 |
# 使用 subprocess 執行 JavaScript 代碼,傳遞語言參數
|
| 11 |
result = subprocess.run(
|
| 12 |
+
['node', 'node_app/pytesseractJsOCR.js', image, language, temp_path + file_name],
|
| 13 |
capture_output=True,
|
| 14 |
text=True
|
| 15 |
)
|
app.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "OCR",
|
| 3 |
-
"scripts": {
|
| 4 |
-
"postdeploy": "npm install"
|
| 5 |
-
},
|
| 6 |
-
"env": {
|
| 7 |
-
"NODE_ENV": "production"
|
| 8 |
-
}
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -75,7 +75,7 @@ def pytesseractJs_ocr(valid_type, language, preprocessed_images, finish_pre_img)
|
|
| 75 |
gr.Warning("請先執行圖像預處理,再進行分析!")
|
| 76 |
raise ValueError("請先執行圖像預處理,再進行分析!")
|
| 77 |
|
| 78 |
-
temp_path = 'TempFile/' + datetime.now().strftime('%Y%m%d_%H%M%S') + '/'
|
| 79 |
# 檢查目錄是否存在,如果不存在則建立
|
| 80 |
if not os.path.exists(temp_path):
|
| 81 |
os.makedirs(temp_path)
|
|
|
|
| 75 |
gr.Warning("請先執行圖像預處理,再進行分析!")
|
| 76 |
raise ValueError("請先執行圖像預處理,再進行分析!")
|
| 77 |
|
| 78 |
+
temp_path = 'node_app/TempFile/' + datetime.now().strftime('%Y%m%d_%H%M%S') + '/'
|
| 79 |
# 檢查目錄是否存在,如果不存在則建立
|
| 80 |
if not os.path.exists(temp_path):
|
| 81 |
os.makedirs(temp_path)
|
package-lock.json → node_app/package-lock.json
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"name": "
|
| 3 |
"lockfileVersion": 3,
|
| 4 |
"requires": true,
|
| 5 |
"packages": {
|
|
|
|
| 1 |
{
|
| 2 |
+
"name": "node_app",
|
| 3 |
"lockfileVersion": 3,
|
| 4 |
"requires": true,
|
| 5 |
"packages": {
|
package.json → node_app/package.json
RENAMED
|
File without changes
|
pytesseractJsOCR.js → node_app/pytesseractJsOCR.js
RENAMED
|
File without changes
|