Spaces:
Running
on
T4
Running
on
T4
Add Filename to description
Browse files
audiocraft/utils/extend.py
CHANGED
|
@@ -157,13 +157,16 @@ def load_font(font_name, font_size=16):
|
|
| 157 |
except (FileNotFoundError, OSError):
|
| 158 |
try:
|
| 159 |
font = ImageFont.truetype(font_name, font_size)
|
|
|
|
| 160 |
except:
|
| 161 |
try:
|
| 162 |
req = requests.get(font_name)
|
| 163 |
font = ImageFont.truetype(BytesIO(req.content), font_size)
|
|
|
|
| 164 |
except:
|
| 165 |
try:
|
| 166 |
-
font = ImageFont.truetype(hf_hub_download("
|
|
|
|
| 167 |
except:
|
| 168 |
font = ImageFont.load_default()
|
| 169 |
return font
|
|
|
|
| 157 |
except (FileNotFoundError, OSError):
|
| 158 |
try:
|
| 159 |
font = ImageFont.truetype(font_name, font_size)
|
| 160 |
+
print("Font not found. Downloading from Hugging Face model hub...\n")
|
| 161 |
except:
|
| 162 |
try:
|
| 163 |
req = requests.get(font_name)
|
| 164 |
font = ImageFont.truetype(BytesIO(req.content), font_size)
|
| 165 |
+
print("Font not found. Downloading from URL...\n")
|
| 166 |
except:
|
| 167 |
try:
|
| 168 |
+
font = ImageFont.truetype(hf_hub_download("/assets", font_name), encoding="UTF-8")
|
| 169 |
+
print(f"Font not found: {font_name} Using default font\n")
|
| 170 |
except:
|
| 171 |
font = ImageFont.load_default()
|
| 172 |
return font
|