zyddnys / manga-image-translator

Translate manga/image 一键翻译各类图片内文字 https://cotrans.touhou.ai/
https://cotrans.touhou.ai/
GNU General Public License v3.0
5.19k stars 535 forks source link

Upload Failed & Access is denies error #42

Closed MoonGoblinDev closed 2 years ago

MoonGoblinDev commented 2 years ago

I cloned the repo and install all the required module, but I get upload failed error with web mode

F:\Offline\Manga[MTL] Machine Translation tool\manga-image-translator-main>python translate_demo.py --mode web --use-inpainting --verbose --translator=google --target-lang=ENG Namespace(mode='web', image='', image_dst='', size=1536, use_inpainting=True, use_cuda=False, force_horizontal=False, inpainting_size=2048, unclip_ratio=2.3, box_threshold=0.7, text_threshold=0.5, text_mag_ratio=1, translator='google', target_lang='ENG', use_ctd=False, verbose=True) -- Loading models -- Running in web service mode -- Waiting for translation tasks fail to initialize deepl : auth_key must not be empty switch to google translator Serving up app on 127.0.0.1:5003

image

Also, when I try to run batch translation, I get access denied error like this F:\Offline\Manga[MTL] Machine Translation tool\manga-image-translator-main>python translate_demo.py --image <F:\Offline\Manga\Sousaku Kanojo\lime message> --use-inpainting --verbose --translator=google --target-lang=ENG Access is denied.

Anyone know the solution or maybe somethings is wrong with my command?

zyddnys commented 2 years ago

First problem fixed in 7e160cb574860579e49cafa22c58ff77203cef3b The second problem is because you have <> around your file path.

MoonGoblinDev commented 2 years ago

First problem fixed in 7e160cb The second problem is because you have <> around your file path.

I got another error with batch translation, it's working when I specify one png file, but I need the batch translation.

F:\Offline\Visual Novel[MTL] Machine Translation tool\manga-image-translator-main>python translate_demo.py --image F:\lime_message\ --use-inpainting --verbose --translator=google --target-lang=ENG

Namespace(mode='demo', image='F:\lime_message\', image_dst='', size=1536, use_inpainting=True, use_cuda=False, force_horizontal=False, inpainting_size=2048, unclip_ratio=2.3, box_threshold=0.7, text_threshold=0.5, text_mag_ratio=1, translator='google', target_lang='ENG', usectd=False, verbose=True) -- Loading models -- Running in single image demo mode [ WARN:0@4.347] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread('F:\lime_message\'): can't open/read file: check file path/integrity -- Detection resolution 1536 -- Detector using default -- Render text direction is auto Traceback (most recent call last): File "F:\Offline\Visual Novel[MTL] Machine Translation tool\manga-image-translator-main\translate_demo.py", line 292, in loop.run_until_complete(main(args.mode)) File "C:\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete return future.result() File "F:\Offline\Visual Novel[MTL] Machine Translation tool\manga-image-translator-main\translate_demo.py", line 233, in main await infer(img, mode, '') File "F:\Offline\Visual Novel[MTL] Machine Translation tool\manga-image-translator-main\translate_demo.py", line 96, in infer img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

zyddnys commented 2 years ago

You are supplying a directory to single image demo mode, that's why you are getting this error. You need --mode batch for batch translation.

zyddnys commented 2 years ago

I fixed this doc problem in bd874196bdb80f27e6c0285c6d59800267e71d4c

MoonGoblinDev commented 2 years ago

You are supplying a directory to single image demo mode, that's why you are getting this error. You need --mode batch for batch translation.

this work nicely but for some reason the result from your demo and the result in my pc is different here's the demo result final

and here's my result lime02_2_01

can you tell me how to make the result become similar with the demo? (Image wise, not translation, my result have this weird gray background)

MoonGoblinDev commented 2 years ago

and it will be nice if it can retain the transparent background in future update if it's possible..

zyddnys commented 2 years ago

Can you share an example image so I can take a look?

MoonGoblinDev commented 2 years ago

Can you share an example image so I can take a look?

here's the PNGs I need to translate https://siasky.net/AABDEIUf1S8C5Xt07t1KIlpvwSJDwQPLZ053Pe80Qx8hxQ

zyddnys commented 2 years ago

fixed in 7bca49b987475382837dc75ce5f72bd95d8f4ed5

MoonGoblinDev commented 2 years ago

fixed in 7bca49b

great.. gray color issue is no more, but is it possible to retain background transparency instead of giving it white background?

zyddnys commented 2 years ago

added in 04377f0500d1a03d7044e2be2648d5df14340dfe

MoonGoblinDev commented 2 years ago

Awesome job.. thanks for the fix!