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 23
23
24
24
import numpy as np # noqa: E402
25
25
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
+
27
39
from PIL import Image # noqa: E402
28
40
29
41
@@ -60,6 +72,9 @@ def __init__(
60
72
self .set_resolution (x_res , y_res )
61
73
self .audio = None
62
74
75
+ if not _librosa_can_be_imported :
76
+ raise ValueError (_import_error )
77
+
63
78
def set_resolution (self , x_res : int , y_res : int ):
64
79
"""Set resolution.
65
80
You can’t perform that action at this time.
0 commit comments