StephaneBah commited on
Commit
d160855
·
verified ·
1 Parent(s): be0ac4e

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +65 -0
  2. fashionlookl1.webp +0 -0
app.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import numpy as np
4
+ from PIL import Image
5
+
6
+ #Fonction du modèle provisoire
7
+ def segment_image(image):
8
+ overlay_image = image.copy()
9
+ return overlay_image
10
+
11
+ def create_interface():
12
+ with gr.Blocks() as interface:
13
+ gr.HTML(
14
+ """<style>
15
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&family=Roboto:wght@400&display=swap');
16
+
17
+ body { background-color: #f0f0f0; font-family: 'Roboto', sans-serif; }
18
+ h1 { font-family: 'Poppins', sans-serif; color: #4CAF50; text-align: center; }
19
+ h3 { font-family: 'Roboto', sans-serif; color: #333; text-align: center; }
20
+ .segment-btn {
21
+ background-color: #4CAF50;
22
+ border-radius: 8px;
23
+ padding: 10px 20px;
24
+ color: white;
25
+ transition: background-color 0.3s ease, transform 0.2s ease;
26
+ }
27
+ .segment-btn:hover {
28
+ background-color: #45a049;
29
+ transform: scale(1.05);
30
+ }
31
+ .logo {
32
+ display: block;
33
+ margin: 0 auto;
34
+ width: 150px;
35
+ height: auto;
36
+ padding: 20px 0;
37
+ }
38
+ </style>"""
39
+ )
40
+ logo_path = os.path.join(os.getcwd(), '/assets/img/fashionlookl1.webp')
41
+ gr.Markdown("<img src=logo_path class='logo' alt='Logo'>")
42
+ gr.Markdown("<h1>FashionLook - Segment Clothes</h1>")
43
+ gr.Markdown("<h3 style='text-align: center;'>" "Upload an image and let our model detect and segment clothes such as shirts, pants, skirts...""</h3>")
44
+ with gr.Row():
45
+ with gr.Column(scale=1):
46
+ gr.Markdown("<h5>Upload your image</h5>")
47
+ image_input = gr.Image(type='pil', label="Upload Image", shape=(512, 512))
48
+ with gr.Row():
49
+ segment_button = gr.Button("Run Segmentation", elem_id="segment-btn")
50
+ with gr.Column(scale=1):
51
+ gr.Markdown("<h5>Segmented Image with Overlay</h5>")
52
+ segmented_image_output = gr.Image(type="pil", label="Segmented Image", interactive=False)
53
+
54
+ # Actions liées aux inputs/outputs
55
+ segment_button.click(
56
+ fn=segment_image,
57
+ inputs=[image_input],
58
+ outputs=[segmented_image_output]
59
+ )
60
+
61
+ return interface
62
+
63
+ # Lancer l'interface
64
+ interface = create_interface()
65
+ interface.launch()
fashionlookl1.webp ADDED