From af4b615aa324c7841dbfd93118354248636706dc Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Fri, 8 Sep 2023 12:58:19 +0300 Subject: [PATCH] The pipeline works end-to-end --- images2text.py | 7 ++++++- text2csvdeck.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/images2text.py b/images2text.py index 0328eff..98142dc 100755 --- a/images2text.py +++ b/images2text.py @@ -75,9 +75,14 @@ def main(directory_path): # Filter out any None values and write the text to final.txt final_text = [text for text in final_text if text is not None] - with open("final.txt", 'w') as f: + FINAL_OUTPUT = "final.txt" + with open(FINAL_OUTPUT, 'w') as f: f.write("\n".join(final_text)) + print(f"All images processed! Final output saved to {FINAL_OUTPUT}") + return FINAL_OUTPUT # Add this line + + if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: python images2text.py ") diff --git a/text2csvdeck.py b/text2csvdeck.py index 29d68ea..876bb70 100644 --- a/text2csvdeck.py +++ b/text2csvdeck.py @@ -47,7 +47,7 @@ def create_csv_deck(text_file_path): # Extract CSV content from response and save to a new file csv_content = response.choices[0]['message']['content'] - output_filename = text_file_path.replace(".txt", "_deck.csv") + output_filename = "output_deck.csv" with open(output_filename, 'w') as csv_file: csv_file.write(csv_content)