zyddnys / manga-image-translator

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

The code didn't work. (in Colab) #119

Closed zzinzziny closed 1 year ago

zzinzziny commented 1 year ago

Thanks for putting such a good project.

I tried running a code in colab. It showed error messages.

Traceback (most recent call last): File "translate_demo.py", line 13, in from detection import dispatch as dispatch_detection, load_model as load_detection_model File "/content/manga-image-translator/manga-image-translator/detection/init.py", line 6, in from utils import Quadrilateral File "/content/manga-image-translator/manga-image-translator/utils.py", line 429, in class Quadrilateral(object): File "/content/manga-image-translator/manga-image-translator/utils.py", line 463, in Quadrilateral def fg_colors(self) -> tuple[int, int, int]: TypeError: 'type' object is not subscriptable

what happens?

thatDudo commented 1 year ago

What is your python version? I have removed the faulty code.

zzinzziny commented 1 year ago

python version is 3.8.

I tried your new code again. It showed another error messages.

usage: translate_demo.py [-h] [-m {demo,batch,web,web2}] -i IMAGE [-o IMAGE_DST] [-l {CHS,CHT,CSY,NLD,ENG,FRA,DEU,HUN,ITA,JPN,KOR,PLK,PTB,ROM,RUS,ESP,TRK,UKR,VIN}] [-v] [--host HOST] [--port PORT] [--log-web] [--ocr {32px,48px_ctc}] [--inpainter {none,default,lama_mpe}] [--translator {google,youdao,baidu,deepl,papago,none,original,offline,offline_big,nnlb,nnlb_big,sugoi,sugoi_small,sugoi_big}] [--use-cuda] [--use-cuda-limited] [--detection-size DETECTION_SIZE] [--inpainting-size INPAINTING_SIZE] [--unclip-ratio UNCLIP_RATIO] [--box-threshold BOX_THRESHOLD] [--text-threshold TEXT_THRESHOLD] [--text-mag-ratio TEXT_MAG_RATIO] [--font-size-offset FONT_SIZE_OFFSET] [--force-horizontal] [--force-vertical] [--upscale-ratio {1,2,4,8,16,32}] [--use-ctd] [--manga2eng] [--eng-font ENG_FONT] translate_demo.py: error: the following arguments are required: -i/--image

thatDudo commented 1 year ago

If you are trying to use this as a module please open a new issue. Otherwise read the error message - it asks for an image file / directory to be supplied.

QiroNT commented 1 year ago

If you are trying to use this as a module please open a new issue. Otherwise read the error message - it asks for an image file / directory to be supplied.

@thatDudo I suppose web mode doesn't really need an image to be specified?

thatDudo commented 1 year ago

ugh, youre right sorry. Do you have direct write access to this repository? If not i can just open a new pull request.

QiroNT commented 1 year ago

Done, thanks for the contribution anyways!