Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,10 +3,10 @@ import gradio as gr
|
|
| 3 |
from ultralytics import YOLO
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
-
# Load YOLOv8 model
|
| 7 |
model = YOLO('best.pt')
|
| 8 |
|
| 9 |
-
# Folder with example test images
|
| 10 |
test_images_folder = 'test_images'
|
| 11 |
test_images = sorted(os.listdir(test_images_folder))
|
| 12 |
|
|
@@ -35,7 +35,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 35 |
uploaded_image = gr.Image(label="Upload your image (optional)", type="filepath")
|
| 36 |
selected_image = gr.Dropdown(choices=test_images, label="Or choose a test image")
|
| 37 |
|
| 38 |
-
gr.Markdown("###
|
| 39 |
output_image = gr.Image(label="Predicted Output")
|
| 40 |
|
| 41 |
gr.Button("Run prediction").click(
|
|
|
|
| 3 |
from ultralytics import YOLO
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
+
# Load YOLOv8 model
|
| 7 |
model = YOLO('best.pt')
|
| 8 |
|
| 9 |
+
# Folder with example test images
|
| 10 |
test_images_folder = 'test_images'
|
| 11 |
test_images = sorted(os.listdir(test_images_folder))
|
| 12 |
|
|
|
|
| 35 |
uploaded_image = gr.Image(label="Upload your image (optional)", type="filepath")
|
| 36 |
selected_image = gr.Dropdown(choices=test_images, label="Or choose a test image")
|
| 37 |
|
| 38 |
+
gr.Markdown("### Prediction Output")
|
| 39 |
output_image = gr.Image(label="Predicted Output")
|
| 40 |
|
| 41 |
gr.Button("Run prediction").click(
|