p0n1 / epub_to_audiobook

EPUB to audiobook converter, optimized for Audiobookshelf
MIT License
888 stars 86 forks source link

I can not convert using OpenAI + Docker #36

Closed amariani closed 5 months ago

amariani commented 5 months ago

Hello, and thank you for this great tool!! 🙌

I am trying to convert an EPUB to audiobook running the following command:

docker run --rm -v ./:/app -e OPENAI_API_KEY=my-openai-key ghcr.io/p0n1/epub_to_audiobook my_ebook.epub audiobook_output --tts openai

But I am getting this error:

/usr/local/lib/python3.11/site-packages/ebooklib/epub.py:1395: UserWarning: In the future version we will turn default option ignore_ncx to True. warnings.warn('In the future version we will turn default option ignore_ncx to True.') /usr/local/lib/python3.11/site-packages/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argumentfeatures="xml"into the BeautifulSoup constructor. warnings.warn( 2024-01-14 19:37:24 [INFO] Chapters count: 14. 2024-01-14 19:37:24 [INFO] Converting chapters from 1 to 14. 2024-01-14 19:37:24 [INFO] ✨ Total characters in selected book: 189325 ✨ Estimate book voiceover would cost you roughly: $2.85 Do you want to continue? (y/n) Traceback (most recent call last): File "/app_src/main.py", line 134, in <module> main() File "/app_src/main.py", line 130, in main AudiobookGenerator(config).run() File "/app_src/audiobook_generator/core/audiobook_generator.py", line 70, in run confirm_conversion(rough_price) File "/app_src/audiobook_generator/core/audiobook_generator.py", line 15, in confirm_conversion answer = input() ^^^^^^^ EOFError: EOF when reading a line

I can't even select Y or N when prompting if I want to continue. Do you now what could I be doing wrong?

p0n1 commented 5 months ago

Let me check.

p0n1 commented 5 months ago

Looks like prompt input is not compatible with docker. Will find a way to resolve this issue.

p0n1 commented 5 months ago

Hi @amariani.

Replace your command into:

docker run -i -t --rm -v ./:/app -e OPENAI_API_KEY=my-openai-key ghcr.io/p0n1/epub_to_audiobook my_ebook.epub audiobook_output --tts openai

Then everything should be OK. You can type in y to confirm estimated cost.

amariani commented 5 months ago

Hi @p0n1, thanks!! It worked perfectly with the provided command! 🚀