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

Method display_results

ML/tests/gui_test.py:460–476  ·  view source on GitHub ↗
(self, predictions, confidences, main_prediction)

Source from the content-addressed store, hash-verified

458 self.prediction_thread.start()
459
460 def display_results(self, predictions, confidences, main_prediction):
461 self.progress_bar.setVisible(False)
462 self.predict_btn.setEnabled(True)
463
464 self.main_prediction.setText(f'🎯 {main_prediction}')
465 self.main_prediction.setStyleSheet('color: #4CAF50; padding: 20px; font-size: 28px;')
466
467 self.confidence_label.setText(f'Confidence: {confidences[0]:.2f}%')
468
469 top5_text = '<h3>Top-5 Predictions:</h3><hr>'
470 for i, (pred, conf) in enumerate(zip(predictions, confidences), 1):
471 bar_width = int(conf * 3)
472 bar = '█' * bar_width
473 top5_text += f'<p style="margin: 10px 0;"><b>{i}. {pred}</b><br>'
474 top5_text += f'<span style="color: #4CAF50;">{bar}</span> {conf:.2f}%</p>'
475
476 self.top5_display.setHtml(top5_text)
477
478 def display_error(self, error_msg):
479 self.progress_bar.setVisible(False)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected