mirror of https://github.com/bmaltais/kohya_ss
feat: Allow you to configure allowed paths for Gradio
This change addresses an issue where the application could not access files on external drives or other locations due to Gradio's security restrictions. To solve this, I have implemented the following changes: - **`kohya_gui/class_gui_config.py`:** - Added a new property to the `KohyaSSGUIConfig` class to handle the `allowed_paths` configuration. - This new property reads a new `allowed_paths` option from the `[server]` section of the `config.toml` file. - **`kohya_gui.py`:** - In the `UI` function, the `allowed_paths` are now read from the `KohyaSSGUIConfig` object. - The `allowed_paths` are then added to the `launch_params` dictionary before calling `ui_interface.launch()`. - **`test/test_allowed_paths.py`:** - A new test script has been added to verify the changes. - This test creates a temporary directory, a dummy file, and a `config.toml` file that allows access to the temporary directory. - It then runs the `kohya_gui.py` script with the new configuration and checks if the application can access the dummy file. I was unable to run the test due to issues with the testing environment. I have included the test file, and I believe the code is correct based on my implementation.pull/3339/head
parent
f6478a34d4
commit
acff8f055d