reduce logging. actual training

This commit is contained in:
Dobromir Popov
2025-10-31 03:52:41 +02:00
parent 6ac324289c
commit 1bf41e06a8
9 changed files with 1700 additions and 74 deletions

View File

@@ -130,6 +130,10 @@ class AnnotationDashboard:
static_folder='static'
)
# Suppress werkzeug request logs (reduce noise from polling endpoints)
werkzeug_logger = logging.getLogger('werkzeug')
werkzeug_logger.setLevel(logging.WARNING) # Only show warnings and errors, not INFO
# Initialize Dash app (optional component)
self.app = Dash(
__name__,
@@ -1125,6 +1129,90 @@ class AnnotationDashboard:
}
})
# Live Training API Endpoints
@self.server.route('/api/live-training/start', methods=['POST'])
def start_live_training():
"""Start live inference and training mode"""
try:
if not self.orchestrator:
return jsonify({
'success': False,
'error': 'Orchestrator not available'
}), 500
if self.orchestrator.start_live_training():
return jsonify({
'success': True,
'status': 'started',
'message': 'Live training mode started'
})
else:
return jsonify({
'success': False,
'error': 'Failed to start live training'
}), 500
except Exception as e:
logger.error(f"Error starting live training: {e}")
return jsonify({
'success': False,
'error': str(e)
}), 500
@self.server.route('/api/live-training/stop', methods=['POST'])
def stop_live_training():
"""Stop live inference and training mode"""
try:
if not self.orchestrator:
return jsonify({
'success': False,
'error': 'Orchestrator not available'
}), 500
if self.orchestrator.stop_live_training():
return jsonify({
'success': True,
'status': 'stopped',
'message': 'Live training mode stopped'
})
else:
return jsonify({
'success': False,
'error': 'Failed to stop live training'
}), 500
except Exception as e:
logger.error(f"Error stopping live training: {e}")
return jsonify({
'success': False,
'error': str(e)
}), 500
@self.server.route('/api/live-training/status', methods=['GET'])
def get_live_training_status():
"""Get live training status and statistics"""
try:
if not self.orchestrator:
return jsonify({
'success': False,
'active': False,
'error': 'Orchestrator not available'
})
is_active = self.orchestrator.is_live_training_active()
stats = self.orchestrator.get_live_training_stats() if is_active else {}
return jsonify({
'success': True,
'active': is_active,
'stats': stats
})
except Exception as e:
logger.error(f"Error getting live training status: {e}")
return jsonify({
'success': False,
'active': False,
'error': str(e)
})
@self.server.route('/api/available-models', methods=['GET'])
def get_available_models():
"""Get list of available models with their load status"""