Spaces:
Running
Running
ziqiangao
commited on
Commit
·
2385693
1
Parent(s):
a383b3e
update app.py
Browse files
app.py
CHANGED
@@ -221,9 +221,7 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
|
|
221 |
else:
|
222 |
raise gr.Error("Mp3 must have a cover image, upload the image under the 'Metadata' section", duration=None)
|
223 |
elif cover_img == -1 and not (tit or ast or img):
|
224 |
-
if img:
|
225 |
-
cover_img = cover_file
|
226 |
-
else:
|
227 |
raise gr.Error("Mp3 is missing tags, add the info under the 'Metadata' section", duration=None)
|
228 |
|
229 |
title, artist = getTitleAndArtist(audio_path)
|
@@ -232,7 +230,11 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
|
|
232 |
gr.Warning('Missing Title or Artist')
|
233 |
else:
|
234 |
title, artist = tit, ast
|
235 |
-
|
|
|
|
|
|
|
|
|
236 |
|
237 |
# Frame rendering parameters
|
238 |
width, height, fps = res[0], res[1], fps
|
@@ -250,7 +252,7 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
|
|
250 |
p((iii, num_frames), desc="Rendering Frames")
|
251 |
|
252 |
except Exception as e:
|
253 |
-
|
254 |
|
255 |
p = gr.Progress()
|
256 |
p(0.5, desc="Compiling video")
|
|
|
221 |
else:
|
222 |
raise gr.Error("Mp3 must have a cover image, upload the image under the 'Metadata' section", duration=None)
|
223 |
elif cover_img == -1 and not (tit or ast or img):
|
224 |
+
if not img:
|
|
|
|
|
225 |
raise gr.Error("Mp3 is missing tags, add the info under the 'Metadata' section", duration=None)
|
226 |
|
227 |
title, artist = getTitleAndArtist(audio_path)
|
|
|
230 |
gr.Warning('Missing Title or Artist')
|
231 |
else:
|
232 |
title, artist = tit, ast
|
233 |
+
if img and cover_img == -1:
|
234 |
+
color_thief = ColorThief(img)
|
235 |
+
dominant_color = color_thief.get_color(quality=1)
|
236 |
+
else:
|
237 |
+
dominant_color = getColour(cover_img)
|
238 |
|
239 |
# Frame rendering parameters
|
240 |
width, height, fps = res[0], res[1], fps
|
|
|
252 |
p((iii, num_frames), desc="Rendering Frames")
|
253 |
|
254 |
except Exception as e:
|
255 |
+
raise gr.Error("Something went wrong whilst rendering")
|
256 |
|
257 |
p = gr.Progress()
|
258 |
p(0.5, desc="Compiling video")
|