update UI
Browse files- S2I/commons/controller.py +3 -3
- app.py +28 -31
S2I/commons/controller.py
CHANGED
@@ -58,10 +58,10 @@ class Sketch2ImageController():
|
|
58 |
self.load_pipeline(zero_options=options)
|
59 |
# prompt = prompt_template.replace("{prompt}", prompt)
|
60 |
|
61 |
-
if
|
62 |
-
img = Image.fromarray(np.array(image["composite"])[:, :, -1])
|
63 |
-
elif type_flag == 'url-sketch':
|
64 |
img = image["composite"]
|
|
|
|
|
65 |
|
66 |
img = img.convert("RGB")
|
67 |
img = img.resize((512, 512))
|
|
|
58 |
self.load_pipeline(zero_options=options)
|
59 |
# prompt = prompt_template.replace("{prompt}", prompt)
|
60 |
|
61 |
+
if input_type:
|
|
|
|
|
62 |
img = image["composite"]
|
63 |
+
else:
|
64 |
+
img = Image.fromarray(np.array(image["composite"])[:, :, -1])
|
65 |
|
66 |
img = img.convert("RGB")
|
67 |
img = img.resize((512, 512))
|
app.py
CHANGED
@@ -221,33 +221,36 @@ with gr.Blocks(css=css, theme="NoCrypt/miku@1.2.1") as demo:
|
|
221 |
)
|
222 |
with gr.Group():
|
223 |
with gr.Row():
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
ui_mode = gr.Radio(
|
232 |
-
choices=["Light Mode", "Dark Mode"],
|
233 |
-
value="Light Mode",
|
234 |
-
label="Switch Light/Dark Mode UI",
|
235 |
-
interactive=True)
|
236 |
-
zero_gpu_options = gr.Radio(
|
237 |
-
choices=["GPU", "CPU"],
|
238 |
-
value="GPU",
|
239 |
-
label="GPU & CPU Options Spaces",
|
240 |
interactive=True)
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
choices=["float32", "float16"],
|
248 |
-
value="float16",
|
249 |
-
label="Demo Speed",
|
250 |
interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
with gr.Column(elem_id="column_output"):
|
253 |
gr.Markdown("## IMAGE GENERATE", elem_id="output_header")
|
@@ -268,12 +271,6 @@ with gr.Blocks(css=css, theme="NoCrypt/miku@1.2.1") as demo:
|
|
268 |
clear_button = gr.Button("Reset Sketch Session", min_width=10, variant='primary')
|
269 |
with gr.Accordion("S2I Advances Option", open=True):
|
270 |
with gr.Row():
|
271 |
-
input_type = gr.Radio(
|
272 |
-
choices=["live-sketch", "url-sketch"],
|
273 |
-
value="live-sketch",
|
274 |
-
label="Type Sketch2Image models",
|
275 |
-
interactive=True)
|
276 |
-
|
277 |
style = gr.Dropdown(
|
278 |
label="Style",
|
279 |
choices=controller.STYLE_NAMES,
|
|
|
221 |
)
|
222 |
with gr.Group():
|
223 |
with gr.Row():
|
224 |
+
with gr.Group():
|
225 |
+
input_type = gr.Checkbox(label="Use URL Image Sketch", value=False)
|
226 |
+
url_image = gr.Textbox(label="Image URLS", value="")
|
227 |
+
type_image = gr.Radio(
|
228 |
+
choices=["RGB", "SKETCH"],
|
229 |
+
value="SKETCH",
|
230 |
+
label="Type of Image (Color Image or Sketch Image)",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
interactive=True)
|
232 |
+
with gr.Group():
|
233 |
+
with gr.Row():
|
234 |
+
ui_mode = gr.Radio(
|
235 |
+
choices=["Light Mode", "Dark Mode"],
|
236 |
+
value="Light Mode",
|
237 |
+
label="Switch Light/Dark Mode UI",
|
|
|
|
|
|
|
238 |
interactive=True)
|
239 |
+
zero_gpu_options = gr.Radio(
|
240 |
+
choices=["GPU", "CPU"],
|
241 |
+
value="GPU",
|
242 |
+
label="GPU & CPU Options Spaces",
|
243 |
+
interactive=True)
|
244 |
+
model_options = gr.Radio(
|
245 |
+
choices=["350k", "350k-adapter"],
|
246 |
+
value="350k-adapter",
|
247 |
+
label="Type Sketch2Image models",
|
248 |
+
interactive=True)
|
249 |
+
half_model = gr.Radio(
|
250 |
+
choices=["float32", "float16"],
|
251 |
+
value="float16",
|
252 |
+
label="Demo Speed",
|
253 |
+
interactive=True)
|
254 |
|
255 |
with gr.Column(elem_id="column_output"):
|
256 |
gr.Markdown("## IMAGE GENERATE", elem_id="output_header")
|
|
|
271 |
clear_button = gr.Button("Reset Sketch Session", min_width=10, variant='primary')
|
272 |
with gr.Accordion("S2I Advances Option", open=True):
|
273 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
style = gr.Dropdown(
|
275 |
label="Style",
|
276 |
choices=controller.STYLE_NAMES,
|