szili2011 commited on
Commit
c55ab98
·
verified ·
1 Parent(s): 373ae9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -9,7 +9,7 @@ def change_pitch(sound, semitones):
9
  pitched_sound = sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate})
10
  return pitched_sound.set_frame_rate(sound.frame_rate)
11
 
12
- def create_sparta_remix(video_file, pitch_shift):
13
  # Define fixed Sparta remix timings (in seconds)
14
  timings = [(0, 5), (10, 15), (20, 25), (30, 35)] # Adjust these as needed
15
 
@@ -58,12 +58,15 @@ def main():
58
  video_input = gr.File(label="Upload Video")
59
 
60
  pitch_shift_input = gr.Slider(minimum=-12, maximum=12, step=1, label="Pitch Shift (semitones)", value=0)
 
 
 
61
  output_video = gr.Video(label="Sparta Remix Output")
62
 
63
- def process_video(video_file, pitch_shift):
64
- return create_sparta_remix(video_file, pitch_shift)
65
 
66
- gr.Button("Create Remix").click(process_video, inputs=[video_input, pitch_shift_input], outputs=output_video)
67
 
68
  demo.launch()
69
 
 
9
  pitched_sound = sound._spawn(sound.raw_data, overrides={'frame_rate': new_sample_rate})
10
  return pitched_sound.set_frame_rate(sound.frame_rate)
11
 
12
+ def create_sparta_remix(video_file, pitch_shift, bpm):
13
  # Define fixed Sparta remix timings (in seconds)
14
  timings = [(0, 5), (10, 15), (20, 25), (30, 35)] # Adjust these as needed
15
 
 
58
  video_input = gr.File(label="Upload Video")
59
 
60
  pitch_shift_input = gr.Slider(minimum=-12, maximum=12, step=1, label="Pitch Shift (semitones)", value=0)
61
+ bpm_input = gr.Slider(minimum=110, maximum=140, step=1, label="BPM (Be ats Per Minute)", value=120)
62
+ pitch_pattern_input = gr.Textbox(label="Pitch Pattern (e.g., 11_11_111_1_1_11222_2_222_222_2_)")
63
+
64
  output_video = gr.Video(label="Sparta Remix Output")
65
 
66
+ def process_video(video_file, pitch_shift, bpm, pitch_pattern):
67
+ return create_sparta_remix(video_file, pitch_shift, bpm)
68
 
69
+ gr.Button("Create Remix").click(process_video, inputs=[video_input, pitch_shift_input, bpm_input, pitch_pattern_input], outputs=output_video)
70
 
71
  demo.launch()
72