Spaces:
Sleeping
Sleeping
Dong Chaoyu
commited on
Commit
·
dd67897
1
Parent(s):
9b852a1
update
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ from sahi import AutoDetectionModel
|
|
| 7 |
from PIL import Image
|
| 8 |
import plotly.graph_objects as go
|
| 9 |
import torch
|
| 10 |
-
import spaces
|
| 11 |
|
| 12 |
import os
|
| 13 |
import shutil
|
|
@@ -31,7 +31,7 @@ class Detection:
|
|
| 31 |
model_type='yolov8',
|
| 32 |
model_path=yolov8_model_path,
|
| 33 |
confidence_threshold=0.3,
|
| 34 |
-
device=
|
| 35 |
)
|
| 36 |
|
| 37 |
def detect_from_image(self, image):
|
|
@@ -218,7 +218,7 @@ def upload_image(image):
|
|
| 218 |
"""Process the uploaded image (if needed) and display it."""
|
| 219 |
return image
|
| 220 |
|
| 221 |
-
|
| 222 |
def apply_detection(image):
|
| 223 |
"""Run object detection on the uploaded image and return the annotated image."""
|
| 224 |
# Convert image from PIL to NumPy array
|
|
@@ -391,11 +391,11 @@ with gr.Blocks() as demo:
|
|
| 391 |
}
|
| 392 |
|
| 393 |
|
| 394 |
-
.gradio-container-5-
|
| 395 |
color: #083484;
|
| 396 |
}
|
| 397 |
|
| 398 |
-
.gradio-container-5-
|
| 399 |
margin-top: 85px
|
| 400 |
}
|
| 401 |
|
|
@@ -477,7 +477,7 @@ with gr.Blocks() as demo:
|
|
| 477 |
font-family: 'Montserrat',sans-serif;
|
| 478 |
}
|
| 479 |
|
| 480 |
-
.gradio-container-5-
|
| 481 |
margin: var(--spacing-xxl) 0 var(--spacing-lg);
|
| 482 |
font-weight: var(--prose-header-text-weight);
|
| 483 |
line-height: 1.3;
|
|
@@ -491,7 +491,7 @@ with gr.Blocks() as demo:
|
|
| 491 |
<header>
|
| 492 |
<div class="left">
|
| 493 |
<h1><span>OIS</span><br></h1>
|
| 494 |
-
<span class="second-line">AI Detection
|
| 495 |
<p>
|
| 496 |
The OIS AI Detection Model enhances manufacturing by using the powerful YOLOv11 algorithm on
|
| 497 |
a Raspberry Pi for real-time, on-device defect detection. It automates quality control,
|
|
|
|
| 7 |
from PIL import Image
|
| 8 |
import plotly.graph_objects as go
|
| 9 |
import torch
|
| 10 |
+
#import spaces
|
| 11 |
|
| 12 |
import os
|
| 13 |
import shutil
|
|
|
|
| 31 |
model_type='yolov8',
|
| 32 |
model_path=yolov8_model_path,
|
| 33 |
confidence_threshold=0.3,
|
| 34 |
+
device="cuda:0" # Change to 'cuda:0' if you are using a GPU
|
| 35 |
)
|
| 36 |
|
| 37 |
def detect_from_image(self, image):
|
|
|
|
| 218 |
"""Process the uploaded image (if needed) and display it."""
|
| 219 |
return image
|
| 220 |
|
| 221 |
+
#@spaces.GPU
|
| 222 |
def apply_detection(image):
|
| 223 |
"""Run object detection on the uploaded image and return the annotated image."""
|
| 224 |
# Convert image from PIL to NumPy array
|
|
|
|
| 391 |
}
|
| 392 |
|
| 393 |
|
| 394 |
+
.gradio-container-5-24-0 .prose * {
|
| 395 |
color: #083484;
|
| 396 |
}
|
| 397 |
|
| 398 |
+
.gradio-container-5-24-0 .prose :first-child {
|
| 399 |
margin-top: 85px
|
| 400 |
}
|
| 401 |
|
|
|
|
| 477 |
font-family: 'Montserrat',sans-serif;
|
| 478 |
}
|
| 479 |
|
| 480 |
+
.gradio-container-5-24-0 .prose h1, .gradio-container-5-24-0 .prose h2, .gradio-container-5-24-0 .prose h3, .gradio-container-5-24-0 .prose h4, .gradio-container-5-24-0 .prose h5 {
|
| 481 |
margin: var(--spacing-xxl) 0 var(--spacing-lg);
|
| 482 |
font-weight: var(--prose-header-text-weight);
|
| 483 |
line-height: 1.3;
|
|
|
|
| 491 |
<header>
|
| 492 |
<div class="left">
|
| 493 |
<h1><span>OIS</span><br></h1>
|
| 494 |
+
<span class="second-line">AI Detection Platform</span>
|
| 495 |
<p>
|
| 496 |
The OIS AI Detection Model enhances manufacturing by using the powerful YOLOv11 algorithm on
|
| 497 |
a Raspberry Pi for real-time, on-device defect detection. It automates quality control,
|