MCPcopy Create free account
hub / github.com/geekcomputers/Python / predict_image

Method predict_image

ML/src/python/neuralforge/cli/gui.py:436–456  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

434 self.model_status.setStyleSheet('color: #f44336;')
435
436 def predict_image(self):
437 image_path = self.image_path_input.text()
438
439 if not image_path or not os.path.exists(image_path):
440 self.main_prediction.setText('Please select a valid image')
441 self.main_prediction.setStyleSheet('color: #f44336;')
442 return
443
444 if self.model is None:
445 self.main_prediction.setText('Please load a model first')
446 self.main_prediction.setStyleSheet('color: #f44336;')
447 return
448
449 self.predict_btn.setEnabled(False)
450 self.progress_bar.setVisible(True)
451 self.progress_bar.setRange(0, 0)
452
453 self.prediction_thread = PredictionThread(self.model, image_path, self.classes, self.device)
454 self.prediction_thread.finished.connect(self.display_results)
455 self.prediction_thread.error.connect(self.display_error)
456 self.prediction_thread.start()
457
458 def display_results(self, predictions, confidences, main_prediction):
459 self.progress_bar.setVisible(False)

Callers

nothing calls this directly

Calls 2

startMethod · 0.80
PredictionThreadClass · 0.70

Tested by

no test coverage detected