Git Product home page Git Product logo

ogkalu2 / comic-translate Goto Github PK

View Code? Open in Web Editor NEW
711.0 5.0 61.0 15.15 MB

Desktop app for automatically translating comics - BDs, Manga, Manhwa, Fumetti and more in a variety of formats (Image, Pdf, Epub, cbr, cbz, etc) and in multiple languages.

License: Apache License 2.0

Python 100.00%
comics computer-vision dearpygui deep-learning gui machine-translation manga manhwa neural-network ocr

comic-translate's People

Contributors

ogkalu2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

comic-translate's Issues

Invalid CUDA 'device=0' requested.

Ultralytics YOLOv8.1.3 🚀 Python-3.10.11 torch-2.1.0+cpu
An Error occurred: Invalid CUDA 'device=0' requested. Use 'device=cpu' or pass valid CUDA device(s) if available, i.e. 'device=0' or 'device=0,1,2,3' for Multi-GPU.

torch.cuda.is_available(): False
torch.cuda.device_count(): 0
os.environ['CUDA_VISIBLE_DEVICES']: 0
See https://pytorch.org/get-started/locally/ for up-to-date torch install instructions if no CUDA devices are seen by torch.
.

Some problems

Unfortunately, the utility in its current form is barely used. 1. Some bubbles are cleaned badly. 2. Some text outside the bubbles (e.g. at the bottom of the page) is not recognised. 3. Recognition through GPT Vision works, but translation through it gives an error. But the main problem is that any recognition error even in one character leads to problem with translation. 4. It is absolutely necessary to have a text editor (before and after translation) with a 5. glossary, 6. text conversion to lower case (so the translation of "Standart sentences." is more correct then the translation "ALL-UPPER SENTENCES.", even without mistakes of OCR), with 7. auto-replacement of problematic characters (for example, words containing İ are not translated). Otherwise, there are dozens of recognition and translation errors per page, and without a text editor, the vast majority of comics remain unreadable. And - please, 8. give option for NOT translating some bubbles - sometimes it recognize some not text but picture and it is a completely disaster.

Error: Request entity too large

First many thanks for this software, but I'm having a "Request entity too large" problem when trying to use it. Is there anything I can do to solve it? The screenshot is attached. Many thanks in advance!!
IMAGE 2024-04-23 09:25:08

sad boy

C:\Users\henti>cd C:\Users\henti\Desktop\comic-translate

C:\Users\henti\Desktop\comic-translate>python comic.py
Traceback (most recent call last):
File "C:\Users\henti\Desktop\comic-translate\comic.py", line 3, in
from modules.utils.download import get_models, mandatory_models
File "C:\Users\henti\Desktop\comic-translate\modules\utils\download.py", line 2, in
from torch.hub import download_url_to_file
File "C:\Users\henti\AppData\Roaming\Python\Python312\site-packages\torch_init_.py", line 141, in
raise err
OSError: [WinError 126] Belirtilen modül bulunamadı. Error loading "C:\Users\henti\AppData\Roaming\Python\Python312\site-packages\torch\lib\shm.dll" or one of its dependencies.

C:\Users\henti\Desktop\comic-translate>

No module named "modules.utils"

Traceback (most recent call last):
File "C:\Users\vladi\Desktop\comic-translate\comic.py", line 3, in
from modules.utils.download import get_models, models_data
ModuleNotFoundError: No module named 'modules.utils'; 'modules' is not a package

Already downloaded all req, downloaded utils but not working

doesn't generate translations on mac

It imports images with a message saying "Imported!", but nothing else seems to happen. it does not say image 1 of 5 etc. Ticking the preview options doesn't seem to do anything. I don't think this is related to credentials (that should pop up an error somewhere), so it must be somewhere earlier in the pipeline. with google translate and default OCR, can you add debugging info so we know if it reaches the OCR or translate stage?

Add local translation models

You can use models like this
It will be great if the user will also be able to select translation models that will consume, for example, 4 GB or 8 GB and so on.

Error importing images

Whenever I try to import an image the gui crashes and I get this error:
python comic.py
[1] 72617 trace trap python comic.py

the error code changes each time.
I swapped to dearpygui==1.10.0 since pip didn't find a 1.10.1 package.
I'm on mac 14.2

Error fugashi

DLL load failed while importing fugashi: The specified module could not be found..

Last progress at forming TextBlocks. Image 1 of 4

I tried running this tool and it gave me this error, I have fugashi installed so i dont know why i got this

Error while launching python comic.py

ERROR | modules.utils.download:get_models:47 - Model sha256: 8c0e395de8fa699daaac21aee33a4ba9bd1309cfbff03147813d2a025f39f349, expected sha256: 415a232fcb9d55b84fe76d859ac75c97987b76c2082c9c13d7f0c6a18c01f30d, wrong model deleted. Please restart comic-translate.

program crash without errors in the console

when trying to translate the program crashes without errors in the console. all requirements have been installed and reinstalled several times, but nothing has worked. tried to install on two devices, but without success. on the main device the processor is intel xeon e5 2470 v2 and video card gtx 1070. I tried with torch==2.1.0+cu121 and torchvision==0.16.0+cu121 as well as with the usual torch specified in the requirements. on a laptop with intel i5 6500 and gt 940 everything is exactly the same. tried to translate with google and yandex translator. i can't get keys for other methods due to lack of money and geographical location....

video demonstration of what's going on - https://drive.google.com/file/d/1eIt1saCCw7NFnLFB6Gs7EiLH76rvNKUv/view?usp=sharing

Janpense something error

i install fugashi but it say fugashi can't import not only vscode, but also cmd. if use AMD chipset can't use this?

TRANSLATION

On the other hand, I wanted to ask if an option could be implemented where, in addition to inserting the image that you want to translate, you could also add the image of the comic in the desired language. What I mean is that, I add 2 photos, one in English at digital quality and another in Spanish from a scanned comic, then I would like to clean the speech bubbles from the image in English and add the ones extracted from the image in Spanish. Resulting in the first image in digital quality but with the texts in Spanish.
since better than translating is to use the original version of texts
231
Spider-girl MC2 - 248

Translator just closed with no errors

I have installed software with python 3.10 and pip install -requirements.txt
I have tried to translate an image and GUI just closed with no errors or logs.
Only message was Using CPU. Note: This module is much faster with a GPU.

I configured with eng->rus, Google Translate.

How could I solve it?

Error installing Torch

During installing dependencies, i have an error instaalling the vesion 2.1.0 of Torch. Then i saw the readme

If you have an NVIDIA GPU, then it is recommended to run

pip uninstall torch torchvision
pip install torch==2.1.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
pip install torchvision==0.16.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html

But the same problem.

E:\comic translate\comic-translate-main>pip uninstall torch torchvision
WARNING: Skipping torch as it is not installed.
WARNING: Skipping torchvision as it is not installed.

E:\comic translate\comic-translate-main>pip install torch==2.1.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==2.1.0+cu121 (from versions: 2.2.0, 2.2.0+cpu, 2.2.0+cu118, 2.2.0+cu121, 2.2.1, 2.2.1+cpu, 2.2.1+cu118, 2.2.1+cu121)
ERROR: No matching distribution found for torch==2.1.0+cu121

E:\comic translate\comic-translate-main>pip install torchvision==0.16.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Ignored the following yanked versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3
ERROR: Could not find a version that satisfies the requirement torchvision==0.16.0+cu121 (from versions: 0.1.6, 0.2.0, 0.17.0, 0.17.0+cpu, 0.17.0+cu118, 0.17.0+cu121, 0.17.1, 0.17.1+cpu, 0.17.1+cu118, 0.17.1+cu121)
ERROR: No matching distribution found for torchvision==0.16.0+cu121

My python is:
E:\comic translate\comic-translate-main>python -V
Python 3.12.2

Frozen GUI

I've installed comic-translate as per the instructions, and (upon receiving the error message noting its necessity) installed fugashi-1.3.2-cp312-cp312-win_amd64 in the folder as well. Now, when I attempt to run comic.py, the Python screen comes up blank, and the GUI pops up (offscreen, but I can maximize it and bring it onto the screen, so that's no problem), but I can't select anything on it; it's like it's frozen or something. Any idea as to what I need to do here?

Font color

text on dark speech clouds is unreadable
Please add a text color setting or auto-color selection for dark and light speech bubbles

Torch/CUDA error when using GPU

So I've tried using GPU to quicken the process. I have RTX2060 and CUDA 12.4. First time I got error that there was no CUDA device available. Then I installed correct PyTorch version for CUDA and this error disappeared. Now there's another error and I have absolutely no clue why it's happening.
изображение_2024-01-31_224235106
error.txt
Maybe it's something with CUDA or Torch again.

use bing

You could try to sign up to use Bing Copilot, which is all free and very powerful, I think it would be great.

Error with opening pdf/epub on Mac M1

I installed python 3.10, cloned the repo and started installing pip requirements. But in finale I get this error

PyMuPDF/setup.py: Finished building mupdf.
PyMuPDF/setup.py: sys.platform='darwin'
PyMuPDF/setup.py: library_dirs=['mupdf-1.20.3-source/build/release', 'mupdf-1.20.3-source/build/release']
PyMuPDF/setup.py: libraries=['mupdf', 'mupdf-third']
PyMuPDF/setup.py: include_dirs=['mupdf-1.20.3-source/include', 'mupdf-1.20.3-source/include/mupdf', 'mupdf-1.20.3-source/thirdparty/freetype/include']
PyMuPDF/setup.py: extra_link_args=[]
running bdist_wheel
running build
running build_py
running build_ext
building 'fitz._fitz' extension
swigging fitz/fitz.i to fitz/fitz_wrap.c
swig -python -o fitz/fitz_wrap.c fitz/fitz.i
error: command 'swig' failed: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for PyMuPDF
Running setup.py clean for PyMuPDF
Failed to build PyMuPDF
ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects

I installed PyMuPDF== 1.23.8 manually, but it didn't helped

error when translating

Last progress at Formando bloques de texto. Imagen 1 de 36
Exception in thread Thread-8:
Traceback (most recent call last):
File "C:\prueba\comic-translate\pipeline.py", line 33, in run
self._target(*self._args, **self._kwargs)
File "C:\prueba\comic-translate\pipeline.py", line 249, in process
ocr_blk_list_google(img, blk_list, google_api_key)
File "C:\prueba\comic-translate\modules\utils\pipeline_utils.py", line 216, in ocr_blk_list_google
y1 = text['boundingPoly']['vertices'][0]['y']
KeyError: 'y'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\threading.py", line 973, in _bootstrap_inner
self.run()
File "C:\prueba\comic-translate\pipeline.py", line 36, in run
self.error_callback(e)
File "C:\prueba\comic-translate\pipeline.py", line 63, in error_handler
messagebox.showerror('Error', f"{exception}.\n\nLast progress at {dpg.get_value('progress_bar_text')}")
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\tkinter\messagebox.py", line 98, in showerror
return show(title, message, ERROR, OK, **options)
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\tkinter\messagebox.py", line 76, in show
res = Message(**options).show()
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\tkinter\commondialog.py", line 42, in show
w = Frame(self.master)
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\tkinter_init
.py", line 3124, in init
Widget.init(self, master, 'frame', cnf, {}, extra)
File "C:\Users\gueva\AppData\Local\Programs\Python\Python39\lib\tkinter_init
.py", line 2572, in init
self.tk.call(
RuntimeError: main thread is not in main loop

Could not find a version that satisfies the requirement dearpygui (from versions: none)

I'm currently unable to install it.

1- I installed Python 3.9 adding it to PATH and for all users, which set it's location to "C:\Program Files(x86)\Python39-32"
2- I created a folder in my desktop: C:\Users\Trabalho\Desktop\text-generation-webui
3- Ran the git clone https://github.com/ogkalu2/comic-translate inside this folder, which created the folder "comic-translate"
4- I then navigated to this folder and ran pip install -r requirements.txt, which returned the error message:

C:\Users\Trabalho\Desktop\text-generation-webui\comic-translate>pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement dearpygui (from versions: none)
ERROR: No matching distribution found for dearpygui

5- python comic.py wield this message:

C:\Users\Trabalho\Desktop\text-generation-webui\comic-translate>python comic.py
Traceback (most recent call last):
  File "C:\Users\Trabalho\Desktop\text-generation-webui\comic-translate\comic.py", line 1, in <module>
    import dearpygui.dearpygui as dpg
ModuleNotFoundError: No module named 'dearpygui'

6- Trying to unnistall and install torch returns this:

C:\Program Files (x86)\Python39-32>pip uninstall torch torchvision
WARNING: Skipping torch as it is not installed.
WARNING: Skipping torchvision as it is not installed.

C:\Program Files (x86)\Python39-32>pip install torch==2.1.0+cu121 -f https://download.pytorch.org/whl/torch_stable.html
Defaulting to user installation because normal site-packages is not writeable
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==2.1.0+cu121 (from versions: none)
ERROR: No matching distribution found for torch==2.1.0+cu121

6- I navigated to Python's folder "C:\Program Files(x86)\Python39-32" and tried to install dearpygui:

C:\Windows\System32>pip install dearpygui
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement dearpygui (from versions: none)
ERROR: No matching distribution found for dearpygui

C:\Windows\System32>pip3 install dearpyguicd C:\Program Files (x86)\Python39-32
Defaulting to user installation because normal site-packages is not writeable
ERROR: Invalid requirement: 'C:\\Program'
Hint: It looks like a path. File 'C:\Program' does not exist.

C:\Windows\System32>cd C:\Program Files (x86)\Python39-32

C:\Program Files (x86)\Python39-32>pip3 install dearpygui
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement dearpygui (from versions: none)
ERROR: No matching distribution found for dearpygui

My system:
i5-13450HX 2.40 GHz
RTX 3050 6GB Laptop
16GB DDR4
Windows 11 x64

Cuda error

image

I just installed cuda paytorch and started the translation

╰─ python comic.py

An Error occurred: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher].

CPU: registered at C:\actions-runner\_work\vision\vision\pytorch\vision\torchvision\csrc\ops\cpu\nms_kernel.cpp:112 [kernel]
QuantizedCPU: registered at C:\actions-runner\_work\vision\vision\pytorch\vision\torchvision\csrc\ops\quantized\cpu\qnms_kernel.cpp:124 [kernel]
BackendSelect: fallthrough registered at ..\aten\src\ATen\core\BackendSelectFallbackKernel.cpp:3 [backend fallback]
Python: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:153 [backend fallback]
FuncTorchDynamicLayerBackMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:498 [backend fallback]
Functionalize: registered at ..\aten\src\ATen\FunctionalizeFallbackKernel.cpp:290 [backend fallback]
Named: registered at ..\aten\src\ATen\core\NamedRegistrations.cpp:7 [backend fallback]
Conjugate: registered at ..\aten\src\ATen\ConjugateFallback.cpp:17 [backend fallback]
Negative: registered at ..\aten\src\ATen\native\NegateFallback.cpp:19 [backend fallback]
ZeroTensor: registered at ..\aten\src\ATen\ZeroTensorFallback.cpp:86 [backend fallback]
ADInplaceOrView: fallthrough registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:86 [backend fallback]
AutogradOther: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:53 [backend fallback]
AutogradCPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:57 [backend fallback]
AutogradCUDA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:65 [backend fallback]
AutogradXLA: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:69 [backend fallback]
AutogradMPS: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:77 [backend fallback]
AutogradXPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:61 [backend fallback]
AutogradHPU: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:90 [backend fallback]
AutogradLazy: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:73 [backend fallback]
AutogradMeta: registered at ..\aten\src\ATen\core\VariableFallbackKernel.cpp:81 [backend fallback]
Tracer: registered at ..\torch\csrc\autograd\TraceTypeManual.cpp:296 [backend fallback]
AutocastCPU: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:382 [backend fallback]
AutocastCUDA: fallthrough registered at ..\aten\src\ATen\autocast_mode.cpp:249 [backend fallback]
FuncTorchBatched: registered at ..\aten\src\ATen\functorch\LegacyBatchingRegistrations.cpp:710 [backend fallback]
FuncTorchVmapMode: fallthrough registered at ..\aten\src\ATen\functorch\VmapModeRegistrations.cpp:28 [backend fallback]
Batched: registered at ..\aten\src\ATen\LegacyBatchingRegistrations.cpp:1075 [backend fallback]
VmapMode: fallthrough registered at ..\aten\src\ATen\VmapModeRegistrations.cpp:33 [backend fallback]
FuncTorchGradWrapper: registered at ..\aten\src\ATen\functorch\TensorWrapper.cpp:203 [backend fallback]
PythonTLSSnapshot: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:161 [backend fallback]
FuncTorchDynamicLayerFrontMode: registered at ..\aten\src\ATen\functorch\DynamicLayer.cpp:494 [backend fallback]
PreDispatch: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:165 [backend fallback]
PythonDispatcher: registered at ..\aten\src\ATen\core\PythonFallbackKernel.cpp:157 [backend fallback]

Error while launching python comic.py

PS C:\Users\АРТУР\Downloads\comic-translate-main> python comic.py
Python
PS C:\Users\АРТУР\Downloads\comic-translate-main> python comic.py
Python
PS C:\Users\АРТУР\Downloads\comic-translate-main>

What is this?

Add a new language

How i can add Ukranian to program?

I added the Ukrainian language to arrays wherever I saw that it was possible, but as a result I get an error

Last progress at
An Error occurred: 'Ukrainian'.

Add Function to Select Multiple PDF Files for Translation

Description
Enhance the file selection dialog to allow users to select multiple PDF files for translation at once.

Objective
Improve user experience by enabling the selection and translation of multiple PDF files simultaneously.

Proposal
Expand the file selection dialog to support multi-file selection.
Add a display to show all selected files before starting the translation.

Request to add Portuguese (Brazillian) target Language

Hello,

I discovered this project, I'm just testing it, and I want to ask if is possible to add pt-BR as a target language, even with just Google Translate as Translator.

Source is English, target is pt-BR, thank you very much.

I'm getting this error here, can someone help me?

C:\comic-translate-main>python comic.py
Traceback (most recent call last):
File "C:\comic-translate-main\comic.py", line 1, in
import dearpygui.dearpygui as dpg
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\dearpygui\dearpygui.py", line 22, in
import dearpygui._dearpygui as internal_dpg
ImportError: DLL load failed while importing _dearpygui: The specified module could not be found.

C:\comic-translate-main>
Untitled

Add non GUI mode

It would be cool if you could use this project as a library or as a console command to automate the translation process

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.