Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def dummy_segmentation(image):
|
| 4 |
+
return image, "Aperçu de l'image segmentée"
|
| 5 |
+
|
| 6 |
+
# Définition de l'interface
|
| 7 |
+
titre = "Analyseur d'Inclusivité de Mode"
|
| 8 |
+
description = "Analysez et recommandez des styles basés sur le type de corps et l'ethnicité à l'aide de la segmentation d'image."
|
| 9 |
+
|
| 10 |
+
custom_css = """
|
| 11 |
+
body {
|
| 12 |
+
font-family: Arial, sans-serif;
|
| 13 |
+
background-color: #f0f0f0;
|
| 14 |
+
color: #333;
|
| 15 |
+
}
|
| 16 |
+
.gradio-container {
|
| 17 |
+
max-width: 800px;
|
| 18 |
+
margin: auto;
|
| 19 |
+
padding: 2rem;
|
| 20 |
+
background: white;
|
| 21 |
+
border-radius: 10px;
|
| 22 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 23 |
+
}
|
| 24 |
+
.gr-button {
|
| 25 |
+
background-color: #007BFF;
|
| 26 |
+
color: white;
|
| 27 |
+
border: none;
|
| 28 |
+
padding: 10px 20px;
|
| 29 |
+
text-align: center;
|
| 30 |
+
font-size: 16px;
|
| 31 |
+
margin: 10px 0;
|
| 32 |
+
border-radius: 5px;
|
| 33 |
+
cursor: pointer;
|
| 34 |
+
transition: background-color 0.3s;
|
| 35 |
+
}
|
| 36 |
+
.gr-button:hover {
|
| 37 |
+
background-color: #0056b3;
|
| 38 |
+
}
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 42 |
+
gr.Markdown(f"# {titre}")
|
| 43 |
+
gr.Markdown(description)
|
| 44 |
+
|
| 45 |
+
with gr.Row():
|
| 46 |
+
with gr.Column():
|
| 47 |
+
input_image = gr.Image(label="Télécharger une image", type="file")
|
| 48 |
+
analyze_button = gr.Button("Analyser")
|
| 49 |
+
|
| 50 |
+
with gr.Column():
|
| 51 |
+
output_image = gr.Image(label="Image segmentée")
|
| 52 |
+
output_text = gr.Textbox(label="Recommandations")
|
| 53 |
+
|
| 54 |
+
# Fonction fictive pour le modèle de segmentation
|
| 55 |
+
analyze_button.click(dummy_segmentation, inputs=input_image, outputs=[output_image, output_text])
|
| 56 |
+
|
| 57 |
+
gr.Markdown("## Résultats")
|
| 58 |
+
gr.Markdown("L'image segmentée et les recommandations de style apparaîtront ici.")
|
| 59 |
+
|
| 60 |
+
demo.launch()
|