import os
import gradio as gr
from PIL import Image
from model import kmeans, mean_shift
with gr.Blocks() as demo:
gr.HTML(
""""""
)
#logo_path = os.path.join(os.getcwd(), 'assets/img/fashionlook1.png')
gr.Markdown("""
""")
gr.Markdown("FashionLook - Segment Clothes
")
gr.Markdown("" "Upload an image and let our model detect and segment clothes such as shirts, pants, skirts...""
")
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("Upload your image
")
image_input = gr.Image(type='pil', label="Upload Image")
with gr.Row():
segment_button = gr.Button("Run Segmentation", elem_id="segment-btn")
with gr.Column(scale=1):
gr.Markdown("Segmented Image with Overlay
")
segmented_image_output = gr.Image(type="pil", label="Segmented Image", interactive=False)
# Actions liƩes aux inputs/outputs
segment_button.click(
fn=kmeans,
inputs=[image_input],
outputs=[segmented_image_output]
)
# Lancer l'interface
demo.launch(share=False)