Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,14 +40,20 @@ def detect_objects_video(video):
|
|
| 40 |
return temp_output.name
|
| 41 |
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
#
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
return temp_output.name
|
| 41 |
|
| 42 |
|
| 43 |
+
# Lancer l'interface avec deux onglets
|
| 44 |
+
with gr.Blocks(theme='shivi/calm_seafoam') as demo:
|
| 45 |
+
gr.Markdown("## 📸 Détection d’objets avec YOLOv8 - Image et Vidéo")
|
| 46 |
+
|
| 47 |
+
with gr.Tab("🖼️ Image"):
|
| 48 |
+
image_input = gr.Image(type="numpy", label="Importer une image")
|
| 49 |
+
image_output = gr.Image(type="numpy", label="Image avec détection")
|
| 50 |
+
image_btn = gr.Button("Analyser l'image")
|
| 51 |
+
image_btn.click(fn=detect_objects_image, inputs=image_input, outputs=image_output)
|
| 52 |
+
|
| 53 |
+
with gr.Tab("🎞️ Vidéo"):
|
| 54 |
+
video_input = gr.Video(label="Importer une vidéo (.mp4)")
|
| 55 |
+
video_output = gr.Video(label="Vidéo traitée")
|
| 56 |
+
video_btn = gr.Button("Analyser la vidéo")
|
| 57 |
+
video_btn.click(fn=detect_objects_video, inputs=video_input, outputs=video_output)
|
| 58 |
+
|
| 59 |
+
demo.launch()
|