Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ class RobustSafetyMonitor:
|
|
17 |
self.colors = [(0, 0, 255), (255, 0, 0), (0, 255, 0), (255, 255, 0), (255, 0, 255)]
|
18 |
|
19 |
# Load YOLOv5 model for general object detection
|
20 |
-
self.yolo_model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
|
21 |
|
22 |
def preprocess_image(self, frame):
|
23 |
"""Process image for analysis."""
|
@@ -186,7 +186,7 @@ def create_monitor_interface():
|
|
186 |
print(f"Processing error: {str(e)}")
|
187 |
return None, f"Error processing image: {str(e)}"
|
188 |
|
189 |
-
input_image.
|
190 |
fn=analyze_image,
|
191 |
inputs=input_image,
|
192 |
outputs=[output_image, analysis_text]
|
|
|
17 |
self.colors = [(0, 0, 255), (255, 0, 0), (0, 255, 0), (255, 255, 0), (255, 0, 255)]
|
18 |
|
19 |
# Load YOLOv5 model for general object detection
|
20 |
+
self.yolo_model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)
|
21 |
|
22 |
def preprocess_image(self, frame):
|
23 |
"""Process image for analysis."""
|
|
|
186 |
print(f"Processing error: {str(e)}")
|
187 |
return None, f"Error processing image: {str(e)}"
|
188 |
|
189 |
+
input_image.upload(
|
190 |
fn=analyze_image,
|
191 |
inputs=input_image,
|
192 |
outputs=[output_image, analysis_text]
|