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

[Feature]: Added option to change SAM model folder location #209

Open
Enchante503 opened this issue May 24, 2024 · 1 comment
Open

[Feature]: Added option to change SAM model folder location #209

Enchante503 opened this issue May 24, 2024 · 1 comment

Comments

@Enchante503
Copy link

Enchante503 commented May 24, 2024

Expected behavior

I'm new to writing code, so I'll have to scrutinize the code, but it seems to work.

#scripts_sam_model_dir = os.path.join(scripts.basedir(), "models/sam")
try:
    sam_models_dir = shared.opts.sam_models_dir
except AttributeError:
    sam_models_dir = ""

if len(sam_models_dir) == 0 or sam_models_dir.isspace():
    scripts_sam_model_dir = os.path.join(scripts.basedir(), "models/sam")
else:
    scripts_sam_model_dir = os.path.expanduser(sam_models_dir)



def on_ui_settings():
    section = ('segment_anything', "Segment Anything")
    shared.opts.add_option("sam_use_local_groundingdino", shared.OptionInfo(False, "Use local groundingdino to bypass C++ problem", section=section))
    shared.opts.add_option("sam_models_dir",
                           shared.OptionInfo(
                                default="",
                                label="Segment Anything Models Directory",
                                component=gr.Textbox,
                                component_args={"interactive": True},
                                section=section))
@dongxiat
Copy link

dongxiat commented Jul 2, 2024

if worked can u make a pull request for everyone can update

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

2 participants