22 lines
627 B
Python
22 lines
627 B
Python
|
import sys
|
||
|
|
||
|
from images2text import main as ocr_images
|
||
|
from prompt4cards import prompt_for_card_content, response_to_json
|
||
|
from json2deck import to_package
|
||
|
|
||
|
|
||
|
def images_to_package(directory_path, outfile):
|
||
|
ocr_text = ocr_images(directory_path)
|
||
|
response_text = prompt_for_card_content(ocr_text)
|
||
|
deck_json = response_to_json(response_text)
|
||
|
to_package(deck_json).write_to_file(outfile)
|
||
|
print(f"Deck created at: {outfile}")
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
if len(sys.argv) != 2:
|
||
|
print("Usage: python ankiai.py <directory_path_containing_images>")
|
||
|
sys.exit(1)
|
||
|
|
||
|
images_to_package(sys.argv[1])
|