MCPcopy Index your code
hub / github.com/geekcomputers/Python / predict_image

Method predict_image

ML/tests/gui_test.py:438–458  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

startMethod · 0.80
PredictionThreadClass · 0.70

Tested by

no test coverage detected