chansung commited on
Commit
78906e0
1 Parent(s): 6f84fcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -476,12 +476,15 @@ def share(title, editor, cover_art):
476
  download_mode=DownloadMode.FORCE_REDOWNLOAD,
477
  verification_mode=VerificationMode.NO_CHECKS
478
  )
479
-
480
- buffered = io.BytesIO()
481
- cover_art = Image.fromarray(cover_art.astype('uint8'))
482
- cover_art.save(buffered, format="JPEG")
483
- img_str = base64.b64encode(buffered.getvalue())
484
 
 
 
 
 
 
 
 
 
485
  dataset['train'] = dataset['train'].add_item({
486
  'title': title,
487
  'story': editor,
 
476
  download_mode=DownloadMode.FORCE_REDOWNLOAD,
477
  verification_mode=VerificationMode.NO_CHECKS
478
  )
 
 
 
 
 
479
 
480
+ if cover_art is not None:
481
+ buffered = io.BytesIO()
482
+ cover_art = Image.fromarray(cover_art.astype('uint8'))
483
+ cover_art.save(buffered, format="JPEG")
484
+ img_str = base64.b64encode(buffered.getvalue())
485
+ else:
486
+ img_str = ""
487
+
488
  dataset['train'] = dataset['train'].add_item({
489
  'title': title,
490
  'story': editor,