A heat gun can be used to seal the edges of the carpet and prevent fraying. Hold the heat gun or blowtorch 3-6 inches away from the carpet to avoid burning it, and work gradually along the edge of the carpet until it is fully sealed.