Add a part to the script that if it can't find res then list all in a scroll list and then give me the ability to input the res 1 by 1 Call the gui FaceFusion DFM Installer and it's created DeepAscension/Cxsmo here is script  import tkinter as tk
from tkinter import filedialog, messagebox, ttk
import os
import re
import shutil

def extract_model_info(dfm_path):
    """
    Extract model information from a .dfm file.
    Modify this function based on how resolution or other info can be extracted from the .dfm file.
    For demonstration, we'll assume .dfm files are named as ModelName.dfm
    Example: Jackie_Chan.dfm
    """
    # Extract the model name without extension
    filename = os.path.basename(dfm_path)
    model_name = os.path.splitext(filename)[0]
    
    # Default size; modify if you have a way to extract size from the model
    size = (224, 224)
    
    return model_name, size

def update_model_set(script_path, dfm_folder):
    try:
        with open(script_path, 'r') as file:
            content = file.read()
        
        # Backup the original script
        backup_path = script_path + ".backup"
        shutil.copy(script_path, backup_path)
        
        # Find the existing MODEL_SET dictionary
        model_set_match = re.search(r"MODEL_SET\s*:\s*ModelSet\s*=\s*({.*?})", content, re.DOTALL)
        if not model_set_match:
            messagebox.showerror("Error", "MODEL_SET dictionary not found in the selected script.")
            return
        
        model_set_str = model_set_match.group(1)
        
        # Prepare to insert new models
        new_models = []
        for filename in os.listdir(dfm_folder):
            if filename.endswith('.dfm'):
                dfm_path = os.path.join(dfm_folder, filename)
                model_name, size = extract_model_info(dfm_path)
                
                # Fixed URLs as per Jackie Chan's model
                hash_url = 'https://huggingface.co/bluefoxcreation/DFM/resolve/main/Jackie_Chan.hash'
                dfm_url = 'https://github.com/iperov/DeepFaceLive/releases/download/JACKIE_CHAN/Jackie_Chan.dfm'
                
                # Construct paths relative to the script's directory
                script_dir = os.path.dirname(script_path)
                relative_hash_path = os.path.relpath(os.path.join(dfm_folder, 'Jackie_Chan.hash'), script_dir)
                relative_dfm_path = os.path.relpath(dfm_path, script_dir)
                
                # Lowercase model name for consistency
                model_key = model_name.lower()
                
                model_entry = f"""
        '{model_key}': {{
            'hashes': {{
                'deep_swapper': {{
                    'url': '{hash_url}',
                    'path': resolve_relative_path('{relative_hash_path}')
                }}
            }},
            'sources': {{
                'deep_swapper': {{
                    'url': '{dfm_url}',
                    'path': resolve_relative_path('{relative_dfm_path}')
                }}
            }},
            'template': 'arcface_128_v2',
            'size': {size}
        }}"""
                new_models.append(model_entry)
        
        if not new_models:
            messagebox.showwarning("No Models Found", "No .dfm files found in the selected folder.")
            return
        
        # Combine all new models
        new_models_str = ",".join(new_models)
        
        # Insert new models before the closing brace of MODEL_SET
        updated_model_set_str = model_set_str.rstrip('}').rstrip() + "," + new_models_str + "\n}"
        
        # Replace the old MODEL_SET with the updated one
        updated_content = content.replace(model_set_str, updated_model_set_str)
        
        with open(script_path, 'w') as file:
            file.write(updated_content)
        
        messagebox.showinfo("Success", f"MODEL_SET updated successfully!\nBackup created at {backup_path}")
    
    except Exception as e:
        messagebox.showerror("Error", f"An error occurred: {str(e)}")

def browse_script():
    file_path = filedialog.askopenfilename(
        title="Select Python Script",
        filetypes=[("Python Files", "*.py")]
    )
    if file_path:
        script_entry.delete(0, tk.END)
        script_entry.insert(0, file_path)

def browse_folder():
    folder_path = filedialog.askdirectory(
        title="Select DFM Folder"
    )
    if folder_path:
        folder_entry.delete(0, tk.END)
        folder_entry.insert(0, folder_path)

def execute_update():
    script_path = script_entry.get()
    dfm_folder = folder_entry.get()
    
    if not os.path.isfile(script_path):
        messagebox.showerror("Error", "Please select a valid Python script.")
        return
    if not os.path.isdir(dfm_folder):
        messagebox.showerror("Error", "Please select a valid DFM folder.")
        return
    
    update_model_set(script_path, dfm_folder)

# Create the main window
root = tk.Tk()
root.title("MODEL_SET Updater")
root.geometry("700x250")
root.resizable(False, False)

# Create and place the widgets
frame = ttk.Frame(root, padding="20 20 20 20")
frame.pack(fill=tk.BOTH, expand=True)

# Python Script Selection
script_label = ttk.Label(frame, text="Select Python Script:")
script_label.grid(column=0, row=0, sticky=tk.W, pady=10)

script_entry = ttk.Entry(frame, width=60)
script_entry.grid(column=1, row=0, pady=10, padx=5, sticky=tk.W)

script_button = ttk.Button(frame, text="Browse", command=browse_script)
script_button.grid(column=2, row=0, padx=5, pady=10)

# DFM Folder Selection
folder_label = ttk.Label(frame, text="Select DFM Folder:")
folder_label.grid(column=0, row=1, sticky=tk.W, pady=10)

folder_entry = ttk.Entry(frame, width=60)
folder_entry.grid(column=1, row=1, pady=10, padx=5, sticky=tk.W)

folder_button = ttk.Button(frame, text="Browse", command=browse_folder)
folder_button.grid(column=2, row=1, padx=5, pady=10)

# Update Button
update_button = ttk.Button(frame, text="Update MODEL_SET", command=execute_update)
update_button.grid(column=1, row=2, pady=30)

# Add padding to all children
for child in frame.winfo_children():
    child.grid_configure(padx=10, pady=5)

# Start the GUI event loop
root.mainloop()