Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -382,19 +382,17 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 382 |
|
| 383 |
with gr.Row():
|
| 384 |
with gr.Column():
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
prompt = gr.Textbox(label="Prompt")
|
| 395 |
-
style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
| 396 |
|
| 397 |
-
|
| 398 |
multiimage_prompt = gr.Gallery(label="Image Prompt", format="png", type="pil", height=300, columns=3)
|
| 399 |
gr.Markdown("""
|
| 400 |
Input different views of the object in separate images.
|
|
@@ -470,12 +468,12 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 470 |
with gr.Row() as single_image_example:
|
| 471 |
examples = gr.Examples(
|
| 472 |
examples=[
|
| 473 |
-
f'assets/
|
| 474 |
-
for image in os.listdir("assets/
|
| 475 |
],
|
| 476 |
inputs=[image_prompt],
|
| 477 |
fn=preprocess_image,
|
| 478 |
-
outputs=[
|
| 479 |
run_on_click=True,
|
| 480 |
examples_per_page=64,
|
| 481 |
)
|
|
@@ -493,10 +491,10 @@ with gr.Blocks(delete_cache=(600, 600)) as demo:
|
|
| 493 |
demo.load(start_session)
|
| 494 |
demo.unload(end_session)
|
| 495 |
|
| 496 |
-
single_image_input_tab.select(
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
)
|
| 500 |
multiimage_input_tab.select(
|
| 501 |
lambda: tuple([True, gr.Row.update(visible=False), gr.Row.update(visible=True)]),
|
| 502 |
outputs=[is_multiimage, single_image_example, multiimage_example]
|
|
|
|
| 382 |
|
| 383 |
with gr.Row():
|
| 384 |
with gr.Column():
|
| 385 |
+
#image_prompt = gr.Image(label="Image Prompt", format="png", image_mode="RGBA", type="pil", height=300)
|
| 386 |
+
with gr.Column():
|
| 387 |
+
image_prompt = gr.ImageMask(type="pil", image_mode="RGB", height=512, value={"background":Image.new("RGB", (512, 512), (255, 255, 255)), "layers":[Image.new("RGB", (512, 512), (255, 255, 255))], "composite":Image.new("RGB", (512, 512), (255, 255, 255))})
|
| 388 |
+
with gr.Row():
|
| 389 |
+
sketch_btn = gr.Button("process sketch")
|
| 390 |
+
generate_btn = gr.Button("Generate 3D")
|
| 391 |
+
with gr.Row():
|
| 392 |
+
prompt = gr.Textbox(label="Prompt")
|
| 393 |
+
style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
|
|
|
|
|
|
| 394 |
|
| 395 |
+
with gr.Tab(label="Multiple Images", id=1, visible=False) as multiimage_input_tab:
|
| 396 |
multiimage_prompt = gr.Gallery(label="Image Prompt", format="png", type="pil", height=300, columns=3)
|
| 397 |
gr.Markdown("""
|
| 398 |
Input different views of the object in separate images.
|
|
|
|
| 468 |
with gr.Row() as single_image_example:
|
| 469 |
examples = gr.Examples(
|
| 470 |
examples=[
|
| 471 |
+
f'assets/example_image_sketches/{image}'
|
| 472 |
+
for image in os.listdir("assets/example_image_sketches")
|
| 473 |
],
|
| 474 |
inputs=[image_prompt],
|
| 475 |
fn=preprocess_image,
|
| 476 |
+
outputs=[image_prompt_processed],
|
| 477 |
run_on_click=True,
|
| 478 |
examples_per_page=64,
|
| 479 |
)
|
|
|
|
| 491 |
demo.load(start_session)
|
| 492 |
demo.unload(end_session)
|
| 493 |
|
| 494 |
+
# single_image_input_tab.select(
|
| 495 |
+
# lambda: tuple([False, gr.Row.update(visible=True), gr.Row.update(visible=False)]),
|
| 496 |
+
# outputs=[is_multiimage, single_image_example, multiimage_example]
|
| 497 |
+
# )
|
| 498 |
multiimage_input_tab.select(
|
| 499 |
lambda: tuple([True, gr.Row.update(visible=False), gr.Row.update(visible=True)]),
|
| 500 |
outputs=[is_multiimage, single_image_example, multiimage_example]
|