Spaces:
Runtime error
Runtime error
Commit ·
e33de4f
1
Parent(s): 8c5b8a7
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,11 +9,14 @@ import torchvision.transforms.functional as F
|
|
| 9 |
from ultralytics import YOLO
|
| 10 |
import gradio as gr
|
| 11 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 12 |
|
| 13 |
model_path_1 = hf_hub_download("Axpo/yolov8x-without-insulators", "yolov8x-without-insulators.pt", use_auth_token=os.environ["TOKEN"])
|
| 14 |
model_path_2 = hf_hub_download("Axpo/yolov8x-with-insulators", "yolov8x-with-insulators.pt", use_auth_token=os.environ["TOKEN"])
|
| 15 |
model_paths = [model_path_1, model_path_2]
|
| 16 |
|
|
|
|
|
|
|
| 17 |
def draw_bboxes_yolo(
|
| 18 |
image: torch.Tensor,
|
| 19 |
bboxes: torch.Tensor,
|
|
@@ -112,14 +115,7 @@ with gr.Blocks() as demo:
|
|
| 112 |
)
|
| 113 |
|
| 114 |
gr.Examples(
|
| 115 |
-
[
|
| 116 |
-
Path(os.path.dirname(__file__)) / "images" / "steel-pole-close.jpg",
|
| 117 |
-
Path(os.path.dirname(__file__)) / "images" / "steel-pole-overview.jpeg",
|
| 118 |
-
Path(os.path.dirname(__file__)) / "images" / "steel-pole-topdown.jpeg",
|
| 119 |
-
Path(os.path.dirname(__file__)) / "images" / "steel-pole-insulators.jpeg",
|
| 120 |
-
Path(os.path.dirname(__file__)) / "images" / "concrete-pole-close.jpeg",
|
| 121 |
-
Path(os.path.dirname(__file__)) / "images" / "concrete-pole-close2.jpeg",
|
| 122 |
-
],
|
| 123 |
input_img,
|
| 124 |
output_img,
|
| 125 |
predict_big_components
|
|
|
|
| 9 |
from ultralytics import YOLO
|
| 10 |
import gradio as gr
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
+
from datasets import load_dataset
|
| 13 |
|
| 14 |
model_path_1 = hf_hub_download("Axpo/yolov8x-without-insulators", "yolov8x-without-insulators.pt", use_auth_token=os.environ["TOKEN"])
|
| 15 |
model_path_2 = hf_hub_download("Axpo/yolov8x-with-insulators", "yolov8x-with-insulators.pt", use_auth_token=os.environ["TOKEN"])
|
| 16 |
model_paths = [model_path_1, model_path_2]
|
| 17 |
|
| 18 |
+
dataset = load_dataset("Axpo/example_pole_images", use_auth_token=os.environ["TOKEN"])
|
| 19 |
+
|
| 20 |
def draw_bboxes_yolo(
|
| 21 |
image: torch.Tensor,
|
| 22 |
bboxes: torch.Tensor,
|
|
|
|
| 115 |
)
|
| 116 |
|
| 117 |
gr.Examples(
|
| 118 |
+
dataset["train"]["image"],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
input_img,
|
| 120 |
output_img,
|
| 121 |
predict_big_components
|