Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -342,28 +342,29 @@ def create_demo(model):
|
|
342 |
|
343 |
with gr.Column():
|
344 |
design_image = gr.Image(label="Output Mask", elem_id='img-display-output')
|
345 |
-
with gr.Column():
|
346 |
-
|
347 |
|
348 |
-
|
349 |
-
|
350 |
-
img_size, detr_confidence_threshold=0.8):
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
367 |
img_size, detr_confidence_threshold=0.8):
|
368 |
|
369 |
model.seed = seed
|
@@ -375,11 +376,13 @@ def create_demo(model):
|
|
375 |
# -----------------
|
376 |
# -- run detr --
|
377 |
# -----------------
|
378 |
-
|
379 |
-
|
|
|
|
|
380 |
|
381 |
submit.click(on_submit, inputs=[input_image, input_text, num_steps, guidance_scale, seed, strength, a_prompt,
|
382 |
-
n_prompt, img_size, detr_confidence_threshold], outputs=
|
383 |
examples = gr.Examples(examples=[["imgs/bedroom_1.jpg", "An elegantly appointed bedroom in the Art Deco style, featuring a grand king-size bed with geometric bedding, a luxurious velvet armchair, and a mirrored nightstand that reflects the room's opulence. Art Deco-inspired artwork adds a touch of glamour"], ["imgs/bedroom_2.jpg", "A bedroom that exudes French country charm with a soft upholstered bed, walls adorned with floral wallpaper, and a vintage wooden wardrobe. A crystal chandelier casts a warm, inviting glow over the space"], ["imgs/dinning_room_1.jpg", "A cozy dining room that captures the essence of rustic charm with a solid wooden farmhouse table at its core, surrounded by an eclectic mix of mismatched chairs. An antique sideboard serves as a statement piece, and the ambiance is warmly lit by a series of quaint Edison bulbs dangling from the ceiling"], ["imgs/dinning_room_3.jpg", "A dining room that epitomizes contemporary elegance, anchored by a sleek, minimalist dining table paired with stylish modern chairs. Artistic lighting fixtures create a focal point above, while the surrounding minimalist decor ensures the space feels open, airy, and utterly modern"], ["imgs/image_1.jpg", "A glamorous master bedroom in Hollywood Regency style, boasting a plush tufted headboard, mirrored furniture reflecting elegance, luxurious fabrics in rich textures, and opulent gold accents for a touch of luxury."], ["imgs/image_2.jpg", "A vibrant living room with a tropical theme, complete with comfortable rattan furniture, large leafy plants bringing the outdoors in, bright cushions adding pops of color, and bamboo blinds for natural light control."], ["imgs/living_room_1.jpg", "A stylish living room embracing mid-century modern aesthetics, featuring a vintage teak coffee table at its center, complemented by a classic sunburst clock on the wall and a cozy shag rug underfoot, creating a warm and inviting atmosphere"]],
|
384 |
inputs=[input_image, input_text], cache_examples=False)
|
385 |
|
|
|
342 |
|
343 |
with gr.Column():
|
344 |
design_image = gr.Image(label="Output Mask", elem_id='img-display-output')
|
345 |
+
# with gr.Column():
|
346 |
+
# bboxes = gr.JSON(label="Detected Objects", elem_id='json-display-output')
|
347 |
|
348 |
+
# def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt,
|
349 |
+
# img_size, detr_confidence_threshold=0.8):
|
|
|
350 |
|
351 |
+
# model.seed = seed
|
352 |
+
# model.neg_prompt = n_prompt
|
353 |
+
# model.additional_quality_suffix = a_prompt
|
354 |
|
355 |
+
# with torch.no_grad():
|
356 |
+
# out_img = model.generate_design(image, text, guidance_scale=guidance_scale, num_steps=num_steps, strength=strength, img_size=img_size)
|
357 |
+
# # -----------------
|
358 |
+
# # -- run detr --
|
359 |
+
# # -----------------
|
360 |
+
# clear_gpu()
|
361 |
+
# detr_model = detr_model.to(device)
|
362 |
+
# bboxes = run_detr(out_img, detr_confidence_threshold)
|
363 |
+
# return out_img, list(bboxes)
|
364 |
+
# submit.click(on_submit, inputs=[input_image, input_text, num_steps, guidance_scale, seed, strength, a_prompt,
|
365 |
+
# n_prompt, img_size, detr_confidence_threshold], outputs=[design_image, bboxes])
|
366 |
+
|
367 |
+
def on_submit(image, text, num_steps, guidance_scale, seed, strength, a_prompt, n_prompt,
|
368 |
img_size, detr_confidence_threshold=0.8):
|
369 |
|
370 |
model.seed = seed
|
|
|
376 |
# -----------------
|
377 |
# -- run detr --
|
378 |
# -----------------
|
379 |
+
# clear_gpu()
|
380 |
+
# detr_model = detr_model.to(device)
|
381 |
+
# bboxes = run_detr(out_img, detr_confidence_threshold)
|
382 |
+
return out_img
|
383 |
|
384 |
submit.click(on_submit, inputs=[input_image, input_text, num_steps, guidance_scale, seed, strength, a_prompt,
|
385 |
+
n_prompt, img_size, detr_confidence_threshold], outputs=design_image)
|
386 |
examples = gr.Examples(examples=[["imgs/bedroom_1.jpg", "An elegantly appointed bedroom in the Art Deco style, featuring a grand king-size bed with geometric bedding, a luxurious velvet armchair, and a mirrored nightstand that reflects the room's opulence. Art Deco-inspired artwork adds a touch of glamour"], ["imgs/bedroom_2.jpg", "A bedroom that exudes French country charm with a soft upholstered bed, walls adorned with floral wallpaper, and a vintage wooden wardrobe. A crystal chandelier casts a warm, inviting glow over the space"], ["imgs/dinning_room_1.jpg", "A cozy dining room that captures the essence of rustic charm with a solid wooden farmhouse table at its core, surrounded by an eclectic mix of mismatched chairs. An antique sideboard serves as a statement piece, and the ambiance is warmly lit by a series of quaint Edison bulbs dangling from the ceiling"], ["imgs/dinning_room_3.jpg", "A dining room that epitomizes contemporary elegance, anchored by a sleek, minimalist dining table paired with stylish modern chairs. Artistic lighting fixtures create a focal point above, while the surrounding minimalist decor ensures the space feels open, airy, and utterly modern"], ["imgs/image_1.jpg", "A glamorous master bedroom in Hollywood Regency style, boasting a plush tufted headboard, mirrored furniture reflecting elegance, luxurious fabrics in rich textures, and opulent gold accents for a touch of luxury."], ["imgs/image_2.jpg", "A vibrant living room with a tropical theme, complete with comfortable rattan furniture, large leafy plants bringing the outdoors in, bright cushions adding pops of color, and bamboo blinds for natural light control."], ["imgs/living_room_1.jpg", "A stylish living room embracing mid-century modern aesthetics, featuring a vintage teak coffee table at its center, complemented by a classic sunburst clock on the wall and a cozy shag rug underfoot, creating a warm and inviting atmosphere"]],
|
387 |
inputs=[input_image, input_text], cache_examples=False)
|
388 |
|