| import gradio as gr |
|
|
|
|
| def segment_image(image): |
| return image |
|
|
| def recommendations(image, couleur, style, taille): |
| return image |
|
|
| with gr.Blocks() as demo: |
| gr.Markdown("#DressSnap") |
|
|
| with gr.Row(): |
|
|
| with gr.Column(scale=1): |
| image_input = gr.Image( |
| type="pil", |
| label="télécharger une image" |
| ) |
| segmentation_button = gr.Button("Segmentation") |
| |
| with gr.Column(scale=1): |
| gr.Markdown("### Options de recommandation") |
| with gr.Row(): |
| couleur_checkbox = gr.CheckboxGroup( |
| ["Rouge", "Bleu", "Vert", "Jaune"], |
| label="Couleur préférée", |
| info="Sélectionnez la couleur des vêtements recommandés" |
| ) |
|
|
| style_checkbox = gr.CheckboxGroup( |
| ["Décontracté", "Formel", "Sportif"], |
| label="Style vestimentaire", |
| info="Sélectionnez le style préféré" |
| ) |
| |
| taille_checkbox = gr.CheckboxGroup( |
| ["XS", "S", "M", "L", "XL"], |
| label="Taille", |
| info="Sélectionnez votre taille" |
| ) |
|
|
| with gr.Row(): |
| image_output = gr.Image( |
| label="Image Modifiée" |
| ) |
|
|
| |
| segmentation_button.click( |
| fn=recommendations, |
| inputs=[image_input, couleur_checkbox, style_checkbox, taille_checkbox], |
| outputs=[image_output] |
| ) |
|
|
| demo.launch() |