Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"path_outputs" in config.txt is ignored #386

Open
thiner opened this issue Jul 29, 2024 · 4 comments
Open

"path_outputs" in config.txt is ignored #386

thiner opened this issue Jul 29, 2024 · 4 comments

Comments

@thiner
Copy link

thiner commented Jul 29, 2024

path_outputs is introduced in config.txt for storing generated images. But Fooocus-API ignores the setting, outputs images to a hard-coded folder output_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..', 'outputs', 'files')) in file_utils.py. I think it's important to expose the configuration of path_outputs to users, especially for API running in Docker container.
My workaround to solve the problem:

output_dir_var = os.environ.get('OUTPUT_DIR', "/tmp")
output_dir = os.path.abspath(os.path.join(output_dir_var, 'files'))

Developer can customize the output path by set an environment variable, e.g. export OUTPUT_DIR=/tmp/fooocus-imgs

@mrhan1993
Copy link
Owner

Okay, this is a headache inducing question. I will try to improve this.

@daedon
Copy link

daedon commented Aug 24, 2024

In config.py:

 if not os.path.exists('user_path_config.txt'):
        return

This should always return since "user_path_config.txt" doesn't exist.
Saving "config.txt" to "user_path_config.txt" results in:

Processing deprecated config failed

Oddly, one day logs and images were written to path_outputs.

@thiner
Copy link
Author

thiner commented Aug 27, 2024

In config.py:

 if not os.path.exists('user_path_config.txt'):
        return

This should always return since "user_path_config.txt" doesn't exist. Saving "config.txt" to "user_path_config.txt" results in:

Processing deprecated config failed

Oddly, one day logs and images were written to path_outputs.

config.py actually is cloned from Fooocus project. If you just want to run Fooocus, the user_path configuration is working fine. The problem here is that Fooocus-API is not aware the setting of config.py in Fooocus. I think the easiest way would be setup a new environment variable to do so.

@antonkoenig
Copy link

The settings from config.txt still work. It still generates the file in the path_outputs directory, but then the file will be moved. You can copy the file instead of moving the file. Then both, the API and the log work without confusion. Files from the API directory can be cleared later. I want to keep the files in the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants