Spaces:
Running
on
Zero
Running
on
Zero
refactor(App): Add Bg removal checkout default value by dict
Browse files
app.py
CHANGED
@@ -94,6 +94,7 @@ Mode = TypedDict(
|
|
94 |
"default_height": int,
|
95 |
"default_width": int,
|
96 |
"models": list[str],
|
|
|
97 |
},
|
98 |
)
|
99 |
|
@@ -110,6 +111,7 @@ MODE_DEFAULTS: dict[str, Mode] = {
|
|
110 |
#"zen_pers_11000",
|
111 |
"zen_26000_512",
|
112 |
],
|
|
|
113 |
},
|
114 |
"Background Generation": {
|
115 |
"model": "gen_back_3000_1024",
|
@@ -132,6 +134,7 @@ MODE_DEFAULTS: dict[str, Mode] = {
|
|
132 |
#"relight_bg_gen_31000_1024",
|
133 |
|
134 |
],
|
|
|
135 |
},
|
136 |
"Canny": {
|
137 |
"model": "canny_21000_1024",
|
@@ -140,6 +143,7 @@ MODE_DEFAULTS: dict[str, Mode] = {
|
|
140 |
"default_height": 1024,
|
141 |
"default_width": 1024,
|
142 |
"models": ["canny_21000_1024"],
|
|
|
143 |
},
|
144 |
"Depth": {
|
145 |
"model": "depth_9800_1024",
|
@@ -150,6 +154,7 @@ MODE_DEFAULTS: dict[str, Mode] = {
|
|
150 |
"models": [
|
151 |
"depth_9800_1024",
|
152 |
],
|
|
|
153 |
},
|
154 |
"Deblurring": {
|
155 |
"model": "slight_deblurr_18000",
|
@@ -159,6 +164,7 @@ MODE_DEFAULTS: dict[str, Mode] = {
|
|
159 |
"default_width": 1024,
|
160 |
"models": [#"slight_deblurr_18000",
|
161 |
"deblurr_1024_10000"],
|
|
|
162 |
},
|
163 |
}
|
164 |
|
@@ -231,7 +237,7 @@ with gr.Blocks(title="🌍 ZenCtrl") as demo:
|
|
231 |
interactive=True,
|
232 |
)
|
233 |
remove_bg_checkbox = gr.Checkbox(
|
234 |
-
label="Remove Background", value=
|
235 |
)
|
236 |
|
237 |
with gr.Column(scale=2):
|
|
|
94 |
"default_height": int,
|
95 |
"default_width": int,
|
96 |
"models": list[str],
|
97 |
+
"remove_bg": bool,
|
98 |
},
|
99 |
)
|
100 |
|
|
|
111 |
#"zen_pers_11000",
|
112 |
"zen_26000_512",
|
113 |
],
|
114 |
+
"remove_bg": True,
|
115 |
},
|
116 |
"Background Generation": {
|
117 |
"model": "gen_back_3000_1024",
|
|
|
134 |
#"relight_bg_gen_31000_1024",
|
135 |
|
136 |
],
|
137 |
+
"remove_bg": True,
|
138 |
},
|
139 |
"Canny": {
|
140 |
"model": "canny_21000_1024",
|
|
|
143 |
"default_height": 1024,
|
144 |
"default_width": 1024,
|
145 |
"models": ["canny_21000_1024"],
|
146 |
+
"remove_bg": True,
|
147 |
},
|
148 |
"Depth": {
|
149 |
"model": "depth_9800_1024",
|
|
|
154 |
"models": [
|
155 |
"depth_9800_1024",
|
156 |
],
|
157 |
+
"remove_bg": True,
|
158 |
},
|
159 |
"Deblurring": {
|
160 |
"model": "slight_deblurr_18000",
|
|
|
164 |
"default_width": 1024,
|
165 |
"models": [#"slight_deblurr_18000",
|
166 |
"deblurr_1024_10000"],
|
167 |
+
"remove_bg": False,
|
168 |
},
|
169 |
}
|
170 |
|
|
|
237 |
interactive=True,
|
238 |
)
|
239 |
remove_bg_checkbox = gr.Checkbox(
|
240 |
+
label="Remove Background", value=defaults["remove_bg"]
|
241 |
)
|
242 |
|
243 |
with gr.Column(scale=2):
|