The diagnosis of primary liver cancers (PLCs) can be challenging, especially on biopsies and for combined hepatocellular-cholangiocarcinoma (cHCC-CCA). We automatically classified PLCs on routine-stained biopsies by using a weakly supervised deep-learning method. Our model identified specific features of hepatocellular carcinoma (HCC) and cholangiocarcinoma (iCCA). Despite no specific features of cHCC-CCA being recognized, the identification of HCC and iCCA tiles within a slide could facilitate the diagnosis of PLCs, and particularly cHCC-CCA, for pathologists.