cmahima commited on
Commit
e3648a7
Β·
1 Parent(s): 3d2b318

theme change

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
  import spaces
3
  from PIL import Image
4
  from src.tryon_pipeline import StableDiffusionXLInpaintPipeline as TryonPipeline
@@ -28,6 +29,10 @@ from detectron2.data.detection_utils import convert_PIL_to_numpy,_apply_exif_ori
28
  from torchvision.transforms.functional import to_pil_image
29
  import amazon_oxy
30
 
 
 
 
 
31
  def pil_to_binary_mask(pil_image, threshold=0):
32
  np_image = np.array(pil_image)
33
  grayscale_image = Image.fromarray(np_image).convert("L")
@@ -278,9 +283,9 @@ def open_link(link):
278
  print(f"link is {link}")
279
  return link
280
  ##default human
281
- my_theme = gr.Theme.from_hub("gradio/small_and_pretty")
282
 
283
- image_blocks = gr.Blocks(theme=my_theme).queue()
284
  with image_blocks as demo:
285
  gr.HTML("<center><h1>Shop with Window πŸ›οΈπŸ‘—πŸ‘•πŸ›’</h1></center>")
286
  gr.HTML("<center><p>Upload an image of yourself or select from examples then describe your garment in the text box and wait for the magic. ✨</p></center>")
@@ -298,6 +303,10 @@ with image_blocks as demo:
298
  examples_per_page=10,
299
  examples=human_ex_list
300
  )
 
 
 
 
301
 
302
  with gr.Column():
303
  prompt = gr.Textbox(placeholder="Description of garment ex: Yellow Top", show_label=False, elem_id="prompt")
@@ -314,13 +323,7 @@ with image_blocks as demo:
314
  buy_link = gr.Textbox(label="URL of Selected Image", interactive=False, visible= False)
315
  buy_button = gr.Button(value="Like it? Click to buy")
316
  output = gr.HTML()
317
- with gr.Column():
318
- with gr.Accordion(label="Advanced Settings", open=False):
319
- with gr.Row():
320
- denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
321
- seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
322
-
323
-
324
  fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, url_display])
325
  image_gallery.select(select_image, [image_gallery, url_display], [garm_img, buy_link])
326
  try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')
 
1
  import gradio as gr
2
+ from gradio.themes.base import Base
3
  import spaces
4
  from PIL import Image
5
  from src.tryon_pipeline import StableDiffusionXLInpaintPipeline as TryonPipeline
 
29
  from torchvision.transforms.functional import to_pil_image
30
  import amazon_oxy
31
 
32
+
33
+ class Seafoam(Base):
34
+ pass
35
+
36
  def pil_to_binary_mask(pil_image, threshold=0):
37
  np_image = np.array(pil_image)
38
  grayscale_image = Image.fromarray(np_image).convert("L")
 
283
  print(f"link is {link}")
284
  return link
285
  ##default human
286
+ seafoam = Seafoam()
287
 
288
+ image_blocks = gr.Blocks(theme=seafoam).queue()
289
  with image_blocks as demo:
290
  gr.HTML("<center><h1>Shop with Window πŸ›οΈπŸ‘—πŸ‘•πŸ›’</h1></center>")
291
  gr.HTML("<center><p>Upload an image of yourself or select from examples then describe your garment in the text box and wait for the magic. ✨</p></center>")
 
303
  examples_per_page=10,
304
  examples=human_ex_list
305
  )
306
+ with gr.Accordion(label="Advanced Settings", open=False):
307
+ with gr.Row():
308
+ denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
309
+ seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
310
 
311
  with gr.Column():
312
  prompt = gr.Textbox(placeholder="Description of garment ex: Yellow Top", show_label=False, elem_id="prompt")
 
323
  buy_link = gr.Textbox(label="URL of Selected Image", interactive=False, visible= False)
324
  buy_button = gr.Button(value="Like it? Click to buy")
325
  output = gr.HTML()
326
+
 
 
 
 
 
 
327
  fetch_button.click(fn=fetch_products, inputs=prompt, outputs=[image_gallery, url_display])
328
  image_gallery.select(select_image, [image_gallery, url_display], [garm_img, buy_link])
329
  try_button.click(fn=start_tryon, inputs=[imgs, garm_img, prompt, is_checked,is_checked_crop, denoise_steps, seed], outputs=[image_out,masked_img], api_name='tryon')