Spaces:
Sleeping
Sleeping
File size: 2,570 Bytes
d160855 c29e5aa 3d3986f d160855 c29e5aa d160855 c29e5aa d160855 3d3986f d160855 3d3986f d43ce8e d160855 3d3986f d160855 |
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 |
import os
import gradio as gr
import numpy as np
from PIL import Image
#Fonction du modèle provisoire
def segment_image(image):
overlay_image = image.copy()
return overlay_image
def create_interface():
with gr.Blocks() as interface:
gr.HTML(
"""<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&family=Roboto:wght@400&display=swap');
body { background-color: #2c2c2c; font-family: 'Roboto', sans-serif; }
h1 { font-family: 'Poppins', sans-serif; color: #ff9800; text-align: center; font-size: 2.5em; margin-bottom: 20px; }
h3 { font-family: 'Roboto', sans-serif; color: #dddddd; text-align: center; margin-bottom: 10px; }
h5 { font-family: 'Roboto', sans-serif; color: #dddddd; text-align: center; margin-bottom: 10px; }
.segment-btn {
background-color: #ff9800;
border-radius: 8px;
padding: 10px 20px;
color: white;
transition: background-color 0.3s ease, transform 0.2s ease;
}
.segment-btn:hover {
background-color: #e67e00;
transform: scale(1.05);
}
.logo {
display: block;
margin: 0 auto;
width: 150px;
height: auto;
padding: 20px 0;
}
</style>"""
)
#logo_path = os.path.join(os.getcwd(), 'fashionlookl1_2.png')
gr.Markdown(f"<img src='fashionlookl1_2.png' class='logo' alt='Logo'>")
gr.Markdown("<h1>FashionLook - Segment Clothes</h1>")
gr.Markdown("<h3 style='text-align: center;'>" "Upload an image and let our model detect and segment clothes such as shirts, pants, skirts...""</h3>")
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("<h5>Upload your image</h5>")
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("<h5>Segmented Image with Overlay</h5>")
segmented_image_output = gr.Image(type="pil", label="Segmented Image", interactive=False)
# Actions liées aux inputs/outputs
segment_button.click(
fn=segment_image,
inputs=[image_input],
outputs=[segmented_image_output]
)
return interface
# Lancer l'interface
interface = create_interface()
interface.launch() |