Spaces:
Running
Running
File size: 3,371 Bytes
7b580ae d2733eb 7b580ae d2733eb 7b580ae d2733eb 7b580ae d2733eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
import gradio as gr
import os
# assets loading
example_path = os.path.join(os.path.dirname(__file__), 'data')
garm_list = os.listdir(os.path.join(example_path,"garment"))
garm_list_path = [os.path.join(example_path, "garment", garm) for garm in garm_list]
person_list = os.listdir(os.path.join(example_path,"person"))
person_list_path = [os.path.join(example_path, "person", person) for person in person_list]
def run_turbo(person_img, garm_img, category):
pass
with gr.Blocks() as Huhu_Turbo:
with gr.Row():
with gr.Column(elem_id = "col-garment"):
gr.HTML("""
<div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 20px;">
<div>
Upload your garment image 🧥
</div>
</div>
""")
with gr.Column(elem_id = "col-person"):
gr.HTML("""
<div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 20px;">
<div>
Select a model image 🧍
</div>
</div>
""")
with gr.Column(elem_id = "col-result"):
gr.HTML("""
<div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 20px;">
<div>
“RUN” to get results 🪄
</div>
</div>
""")
with gr.Row():
with gr.Column(elem_id = "col-garment"):
garm_img = gr.Image(label="Garment image", sources='upload', type="numpy")
category = gr.Dropdown(label="Garment type", choices=['Top', 'Bottom', 'Fullbody'], value="Top")
example = gr.Examples(
inputs=garm_img,
examples_per_page=6,
examples=garm_list_path
)
with gr.Column(elem_id = "col-person"):
person_img = gr.Image(label="Person image", sources='upload', type="numpy")
example = gr.Examples(
inputs=person_img,
examples_per_page=6,
examples=person_list_path
)
with gr.Column(elem_id = "col-result"):
result_img = gr.Image(label="Result", show_share_button=False)
with gr.Row():
result_info = gr.Text(label="Generation time")
generate_button = gr.Button(value="“RUN”", elem_id="button")
generate_button.click(fn=run_turbo, inputs=[person_img, garm_img, category], outputs=[result_img, result_info], api_name=False, concurrency_limit=30)
with gr.Column(elem_id = "col-showcase"):
gr.HTML("""
<div style="display: flex; justify-content: center; align-items: center; text-align: center; font-size: 20px;">
<div> </div>
<br>
<div>
Huhu-turbo try-on examples in pairs of garment and person images
</div>
</div>
""")
show_case = gr.Examples(
examples=[
["data/examples/garment_example.png", "data/examples/person_example.png", "data/examples/result_example.png"],
],
inputs=[person_img, garm_img, result_img],
label=None
)
Huhu_Turbo.queue(api_open=False).launch(show_api=False)
|