Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from ultralytics import YOLO
|
| 5 |
+
|
| 6 |
+
model = YOLO("yolov8n.pt") # load a pretrained model (recommended for training)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
# Chargez l'image
|
| 10 |
+
e =""
|
| 11 |
+
# Fonction pour générer le contenu
|
| 12 |
+
def generate_content(pro,image):
|
| 13 |
+
global e
|
| 14 |
+
results = model(image)
|
| 15 |
+
e = results
|
| 16 |
+
return e
|
| 17 |
+
markdown = r"""
|
| 18 |
+
e
|
| 19 |
+
""".format(e)
|
| 20 |
+
# Interface Gradio
|
| 21 |
+
iface = gr.Interface(fn=generate_content, inputs=[gr.Textbox(),gr.Image(type='pil')], outputs= gr.Image(type='pil'))
|
| 22 |
+
|
| 23 |
+
iface.launch()
|