Skip to content

Instantly share code, notes, and snippets.

@waynegraham
Created August 26, 2023 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynegraham/4e4d40537440d0e2a1ffd21ad7631c1f to your computer and use it in GitHub Desktop.
Save waynegraham/4e4d40537440d0e2a1ffd21ad7631c1f to your computer and use it in GitHub Desktop.
Create text files for LORA model
import os
import shutil
def create_text_file(jpeg_file):
"""Creates a text file with the same name as the given JPEG file."""
text_file_name = jpeg_file.split(".")[0] + ".txt"
text_file = open(text_file_name, "w")
text_file.write("")
text_file.close()
jpeg_files = os.listdir('.')
for jpeg_file in jpeg_files:
if jpeg_file.endswith(".JPEG") or jpeg_file.endswith(".JPG"):
create_text_file(jpeg_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment