mirror of
https://git.mirrors.martin98.com/https://github.com/danielgatis/rembg
synced 2025-08-18 00:55:56 +08:00
fix invalid model fresh install
This commit is contained in:
parent
ca4be25f90
commit
b07192d16f
2
setup.py
2
setup.py
@ -11,7 +11,7 @@ with open("requirements.txt") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="rembg",
|
name="rembg",
|
||||||
version="1.0.25",
|
version="1.0.26",
|
||||||
description="Remove image background",
|
description="Remove image background",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
@ -15,7 +15,8 @@ def main():
|
|||||||
os.path.expanduser(os.path.join("~", ".u2net")),
|
os.path.expanduser(os.path.join("~", ".u2net")),
|
||||||
)
|
)
|
||||||
model_choices = [os.path.splitext(os.path.basename(x))[0] for x in set(glob.glob(model_path + "/*"))]
|
model_choices = [os.path.splitext(os.path.basename(x))[0] for x in set(glob.glob(model_path + "/*"))]
|
||||||
|
if len(model_choices) == 0:
|
||||||
|
model_choices = ["u2net", "u2netp", "u2net_human_seg"]
|
||||||
|
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ def index():
|
|||||||
os.path.expanduser(os.path.join("~", ".u2net")),
|
os.path.expanduser(os.path.join("~", ".u2net")),
|
||||||
)
|
)
|
||||||
model_choices = [os.path.splitext(os.path.basename(x))[0] for x in set(glob.glob(model_path + "/*"))]
|
model_choices = [os.path.splitext(os.path.basename(x))[0] for x in set(glob.glob(model_path + "/*"))]
|
||||||
|
if len(model_choices) == 0:
|
||||||
|
model_choices = ["u2net", "u2netp", "u2net_human_seg"]
|
||||||
|
|
||||||
if model not in model_choices:
|
if model not in model_choices:
|
||||||
return {"error": f"invalid query param 'model'. Available options are {model_choices}"}, 400
|
return {"error": f"invalid query param 'model'. Available options are {model_choices}"}, 400
|
||||||
|
Loading…
x
Reference in New Issue
Block a user