The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
_ui.py import torchaudio safety check (#9234)
Jedrzej Kosinski42974a448c39
diff --git a/comfy_api/latest/_ui.py b/comfy_api/latest/_ui.pyindex 6b8a39d58..61597038f 100644--- a/comfy_api/latest/_ui.py+++ b/comfy_api/latest/_ui.py@@ -9,7 +9,11 @@ from typing import Typeimport avimport numpy as npimport torch-import torchaudio+try:+ import torchaudio+ TORCH_AUDIO_AVAILABLE = True+except ImportError:+ TORCH_AUDIO_AVAILABLE = Falsefrom PIL import Image as PILImagefrom PIL.PngImagePlugin import PngInfo@@ -302,6 +306,8 @@ class AudioSaveHelper:# Resample if necessaryif sample_rate != audio["sample_rate"]:+ if not TORCH_AUDIO_AVAILABLE:+ raise Exception("torchaudio is not available; cannot resample audio.")waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)# Create output with specified format