Spaces:
Running
Running
import os | |
def create_output_directory(directory="output"): | |
"""Create output directory if it doesn't exist""" | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
return directory | |
def allowed_file(filename): | |
"""Check if file has allowed extension""" | |
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'} | |
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | |