kjysmu commited on
Commit
b7b25ed
1 Parent(s): 1f2b5f0

modify app v2

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -121,7 +121,7 @@ def gen_semantic_feature(frame_dir, semantic_dir):
121
  features[idx] = image_features[0]
122
  features = features.numpy()
123
  np.save(output_path, features)
124
-
125
  def gen_emotion_feature(frame_dir, emotion_dir):
126
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
127
  model, preprocess = clip.load("ViT-L/14@336px", device=device)
@@ -460,14 +460,15 @@ class Video2music:
460
  chordRootDic = json.load(json_file)
461
  with open('dataset/vevo_meta/chord_attr.json') as json_file:
462
  chordAttrDic = json.load(json_file)
463
-
 
464
  if primer.strip() == "":
465
  if "major" in key:
466
  primer = "C"
467
  else:
468
  primer = "Am"
469
 
470
- pChordList = primer.split(" ")
471
 
472
  primerCID = []
473
  primerCID_root = []
@@ -497,9 +498,10 @@ class Video2music:
497
  if pChord[type_idx+1:] == "":
498
  pChord = pChord[0:type_idx]
499
 
 
500
  chordID = chordDic[pChord]
501
  primerCID.append(chordID)
502
-
503
  chord_arr = pChord.split(":")
504
  if len(chord_arr) == 1:
505
  chordRootID = chordRootDic[chord_arr[0]]
 
121
  features[idx] = image_features[0]
122
  features = features.numpy()
123
  np.save(output_path, features)
124
+
125
  def gen_emotion_feature(frame_dir, emotion_dir):
126
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
127
  model, preprocess = clip.load("ViT-L/14@336px", device=device)
 
460
  chordRootDic = json.load(json_file)
461
  with open('dataset/vevo_meta/chord_attr.json') as json_file:
462
  chordAttrDic = json.load(json_file)
463
+
464
+ primer = primer.strip()
465
  if primer.strip() == "":
466
  if "major" in key:
467
  primer = "C"
468
  else:
469
  primer = "Am"
470
 
471
+ pChordList = primer.split()
472
 
473
  primerCID = []
474
  primerCID_root = []
 
498
  if pChord[type_idx+1:] == "":
499
  pChord = pChord[0:type_idx]
500
 
501
+ print("pchord is ", pChord)
502
  chordID = chordDic[pChord]
503
  primerCID.append(chordID)
504
+
505
  chord_arr = pChord.split(":")
506
  if len(chord_arr) == 1:
507
  chordRootID = chordRootDic[chord_arr[0]]