Spaces:
Sleeping
Sleeping
fix error
Browse files
app.py
CHANGED
@@ -156,7 +156,7 @@ def gen_emotion_feature(frame_dir, emotion_dir):
|
|
156 |
for i in range(0, len(emolist) ):
|
157 |
f.write(str(i) + " "+emolist[i]+"\n")
|
158 |
|
159 |
-
def gen_scene_feature(video, scene_dir):
|
160 |
video_stream = open_video(str(video))
|
161 |
|
162 |
scene_manager = SceneManager()
|
@@ -173,9 +173,16 @@ def gen_scene_feature(video, scene_dir):
|
|
173 |
sec += 1
|
174 |
|
175 |
fpathname = scene_dir / "scene.lab"
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
def gen_scene_offset_feature(scene_dir, scene_offset_dir):
|
181 |
src = scene_dir / "scene.lab"
|
@@ -421,7 +428,7 @@ class Video2music:
|
|
421 |
split_video_into_frames(video, frame_dir)
|
422 |
gen_semantic_feature(frame_dir, semantic_dir)
|
423 |
gen_emotion_feature(frame_dir, emotion_dir)
|
424 |
-
gen_scene_feature(video, scene_dir)
|
425 |
gen_scene_offset_feature(scene_dir, scene_offset_dir)
|
426 |
gen_motion_feature(video, motion_dir)
|
427 |
|
@@ -802,28 +809,27 @@ with gr.Blocks(css=css) as demo:
|
|
802 |
with gr.Row():
|
803 |
with gr.Column():
|
804 |
radio = gr.Radio(["Upload Video", "YouTube URL"], value="Upload Video", label = "Choose the input method")
|
805 |
-
with gr.Row(visible=True) as mainA:
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
btn_yt = gr.Button("Generate")
|
827 |
|
828 |
with gr.Column():
|
829 |
with gr.Row():
|
|
|
156 |
for i in range(0, len(emolist) ):
|
157 |
f.write(str(i) + " "+emolist[i]+"\n")
|
158 |
|
159 |
+
def gen_scene_feature(video, scene_dir, frame_dir):
|
160 |
video_stream = open_video(str(video))
|
161 |
|
162 |
scene_manager = SceneManager()
|
|
|
173 |
sec += 1
|
174 |
|
175 |
fpathname = scene_dir / "scene.lab"
|
176 |
+
|
177 |
+
if len(scene_list) == 0:
|
178 |
+
fsize = len( os.listdir(frame_dir) )
|
179 |
+
with open(fpathname,'w',encoding = 'utf-8') as f:
|
180 |
+
for i in range(0, fsize):
|
181 |
+
f.write(str(i) + " "+"0"+"\n")
|
182 |
+
else:
|
183 |
+
with open(fpathname,'w',encoding = 'utf-8') as f:
|
184 |
+
for i in range(0, len(scenedict)):
|
185 |
+
f.write(str(i) + " "+scenedict[i]+"\n")
|
186 |
|
187 |
def gen_scene_offset_feature(scene_dir, scene_offset_dir):
|
188 |
src = scene_dir / "scene.lab"
|
|
|
428 |
split_video_into_frames(video, frame_dir)
|
429 |
gen_semantic_feature(frame_dir, semantic_dir)
|
430 |
gen_emotion_feature(frame_dir, emotion_dir)
|
431 |
+
gen_scene_feature(video, scene_dir, frame_dir)
|
432 |
gen_scene_offset_feature(scene_dir, scene_offset_dir)
|
433 |
gen_motion_feature(video, motion_dir)
|
434 |
|
|
|
809 |
with gr.Row():
|
810 |
with gr.Column():
|
811 |
radio = gr.Radio(["Upload Video", "YouTube URL"], value="Upload Video", label = "Choose the input method")
|
812 |
+
# with gr.Row(visible=True) as mainA:
|
813 |
+
# with gr.Column(visible=True) as colA:
|
814 |
+
with gr.Column(visible=True) as rowA:
|
815 |
+
with gr.Row():
|
816 |
+
input_video = gr.Video(label="Input Video", height=250)
|
817 |
+
with gr.Row():
|
818 |
+
with gr.Row():
|
819 |
+
input_primer = gr.Textbox(label="Input Primer", value="C Am F G")
|
820 |
+
input_key = gr.Dropdown(choices=["C major", "A minor"], value="C major", label="Input Key")
|
821 |
+
with gr.Row():
|
822 |
+
btn = gr.Button("Generate")
|
823 |
+
|
824 |
+
with gr.Column(visible=False) as rowB:
|
825 |
+
with gr.Row():
|
826 |
+
input_video_yt = gr.Textbox(label="YouTube URL")
|
827 |
+
with gr.Row():
|
828 |
+
with gr.Row():
|
829 |
+
input_primer_yt = gr.Textbox(label="Input Primer", value="C Am F G")
|
830 |
+
input_key_yt = gr.Dropdown(choices=["C major", "A minor"], value="C major", label="Input Key")
|
831 |
+
with gr.Row():
|
832 |
+
btn_yt = gr.Button("Generate")
|
|
|
833 |
|
834 |
with gr.Column():
|
835 |
with gr.Row():
|