Spaces:
Sleeping
Sleeping
Commit
·
a0af339
1
Parent(s):
1ceae83
10/24 first update from tryon
Browse files- app.py +56 -2
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -10,8 +10,62 @@ import gradio as gr
|
|
| 10 |
def greet(name):
|
| 11 |
return "Hello " + name + "!!"
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
print("why")
|
| 17 |
print("s")
|
|
|
|
| 10 |
def greet(name):
|
| 11 |
return "Hello " + name + "!!"
|
| 12 |
|
| 13 |
+
def start_tryon():
|
| 14 |
+
return "Hello " + "**" + "!!"
|
| 15 |
+
|
| 16 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 17 |
+
# iface.launch()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
human_ex_list = []
|
| 21 |
+
for ex_human in human_ex_list:
|
| 22 |
+
ex_dict = {}
|
| 23 |
+
ex_dict['background'] = ex_human
|
| 24 |
+
ex_dict['layers'] = None
|
| 25 |
+
ex_dict['composite'] = None
|
| 26 |
+
human_ex_list.append(ex_dict)
|
| 27 |
+
|
| 28 |
+
## default human
|
| 29 |
+
|
| 30 |
+
image_blocks = gr.Blocks().queue()
|
| 31 |
+
|
| 32 |
+
with image_blocks as demo:
|
| 33 |
+
gr.Markdown("## Virtual Try On")
|
| 34 |
+
gr.Markdown("Virtual Try -n with your image and garment image.")
|
| 35 |
+
with gr.Row():
|
| 36 |
+
with gr.Column():
|
| 37 |
+
imgs = gr.ImageEditor(sources='upload', type='pil', label='Human, Mask with pen or use auto-masking', interactive=True)
|
| 38 |
+
with gr.Row():
|
| 39 |
+
is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)", value=True)
|
| 40 |
+
with gr.Row():
|
| 41 |
+
is_checked_crop = gr.Checkbox(label="Yes", info="Use auto-crop & resizing", value=False)
|
| 42 |
+
### EXAMPLE TODO
|
| 43 |
+
example = gr.Examples(
|
| 44 |
+
inputs=imgs,
|
| 45 |
+
example_per_page=10,
|
| 46 |
+
examples=human_ex_list
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
with gr.Column():
|
| 50 |
+
garm_img = gr.Image(label="Garment", sources='upload', type='pil')
|
| 51 |
+
with gr.Row(elem_id="promt-container"):
|
| 52 |
+
prompt = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
|
| 53 |
+
### EXAPLE TODO
|
| 54 |
+
|
| 55 |
+
with gr.Column():
|
| 56 |
+
masked_img = gr.Image(label="Masked iamge output", elem_id="masked-img", show_share_button=False)
|
| 57 |
+
with gr.Column():
|
| 58 |
+
image_out = gr.Image(label="Output", elem_id="output-img", show_share_button=False)
|
| 59 |
+
|
| 60 |
+
with gr.Column():
|
| 61 |
+
try_button = gr.Button(value="Try-on")
|
| 62 |
+
with gr.Accordion(label = "Advanced Settings", open=False):
|
| 63 |
+
with gr.Row():
|
| 64 |
+
denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
|
| 65 |
+
seed = gr.Number(label="Seed", minimum=-1, maximum=2147483647, step=1, value=42)
|
| 66 |
+
|
| 67 |
+
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')
|
| 68 |
+
|
| 69 |
|
| 70 |
print("why")
|
| 71 |
print("s")
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio==5.1.0
|