File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/diffusers/pipelines/audio_diffusion Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 2323
2424import numpy as np # noqa: E402
2525
26- import librosa # noqa: E402
26+
27+ try :
28+ import librosa # noqa: E402
29+
30+ _librosa_can_be_imported = True
31+ _import_error = ""
32+ except Exception as e :
33+ _librosa_can_be_imported = False
34+ _import_error = (
35+ f"Cannot import librosa because { e } . Make sure to correctly install librosa to be able to install it."
36+ )
37+
38+
2739from PIL import Image # noqa: E402
2840
2941
@@ -60,6 +72,9 @@ def __init__(
6072 self .set_resolution (x_res , y_res )
6173 self .audio = None
6274
75+ if not _librosa_can_be_imported :
76+ raise ValueError (_import_error )
77+
6378 def set_resolution (self , x_res : int , y_res : int ):
6479 """Set resolution.
6580
You can’t perform that action at this time.
0 commit comments