You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't created benchmarks - it would be a great contribution if anyone wants to add this.
The design of this library is asynchrous (concurrent) but not parallel (multi-threaded). You can use coroutines to create in-thread concurrency but its not multi-threaded.
To effectively use this library you simply need to use the basic asyncio primitives - or those from anyio if you prefer abstractions and handle multiple files in a non-blocking fashion:
fromasyncioimportgatherfrompathlibimportPathfromkreuzbergimportextract_fileasyncdefhandle_multiple_files(files_to_extract: list[Path]) ->list[str]:
"""Concurrently extract text from multiple files"""returnawaitgather(*[extract_file(file) forfileinfiles_to_extract])
This function will execute the extract_file functions concurrently.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I haven't created benchmarks - it would be a great contribution if anyone wants to add this.
The design of this library is asynchrous (concurrent) but not parallel (multi-threaded). You can use coroutines to create in-thread concurrency but its not multi-threaded.
To effectively use this library you simply need to use the basic asyncio primitives - or those from
anyio
if you prefer abstractions and handle multiple files in a non-blocking fashion:This function will execute the extract_file functions concurrently.
Beta Was this translation helpful? Give feedback.
All reactions