We propose a method for assessing the risk of losses on bank lending to the non-financial corporate sector based on bankruptcy probability modelling. We estimate bankruptcy models for different industries and attach a risk weight to each firm's debt in a given year. The risk weight is equal to the probability of bankruptcy. By summing all risk-weighted debt in an industry, we obtain an estimate of the share of debt in bankruptcy accounts in a given year. A key feature of our model is the inclusion of economic indicators at the industry level, observed in real time, as explanatory variables together with standard financial accounting variables and real-time credit rating information. We find that historically, during 2000-2014, there is good correspondence between our estimated measure of risk-weighted debt and actual debt in bankruptcy accounts. Moreover, bank losses according to bank statistics and debt in bankruptcy accounts display a similar pattern over time in most industries