Spaces:
Running
on
T4
Running
on
T4
UI Update to reduce hacking
Browse files-specify seconds in duration label
- app.py +1 -1
- audiocraft/utils/extend.py +3 -0
app.py
CHANGED
@@ -301,7 +301,7 @@ def ui(**kwargs):
|
|
301 |
with gr.Row():
|
302 |
text = gr.Text(label="Describe your music", interactive=True, value="4/4 100bpm 320kbps 48khz, Industrial/Electronic Soundtrack, Dark, Intense, Sci-Fi")
|
303 |
with gr.Column():
|
304 |
-
duration = gr.Slider(minimum=1, maximum=720, value=10, label="Duration", interactive=True)
|
305 |
model = gr.Radio(["melody", "medium", "small", "large"], label="AI Model", value="melody", interactive=True)
|
306 |
with gr.Row():
|
307 |
submit = gr.Button("Generate", elem_id="btn-generate")
|
|
|
301 |
with gr.Row():
|
302 |
text = gr.Text(label="Describe your music", interactive=True, value="4/4 100bpm 320kbps 48khz, Industrial/Electronic Soundtrack, Dark, Intense, Sci-Fi")
|
303 |
with gr.Column():
|
304 |
+
duration = gr.Slider(minimum=1, maximum=720, value=10, label="Duration (s)", interactive=True)
|
305 |
model = gr.Radio(["melody", "medium", "small", "large"], label="AI Model", value="melody", interactive=True)
|
306 |
with gr.Row():
|
307 |
submit = gr.Button("Generate", elem_id="btn-generate")
|
audiocraft/utils/extend.py
CHANGED
@@ -58,6 +58,9 @@ def generate_music_segments(text, melody, seed, MODEL, duration:int=10, overlap:
|
|
58 |
last_chunk = []
|
59 |
text += ", seed=" + str(seed)
|
60 |
prompt_segment = None
|
|
|
|
|
|
|
61 |
|
62 |
# Calculate the total number of segments
|
63 |
total_segments = max(math.ceil(duration / segment_duration),1)
|
|
|
58 |
last_chunk = []
|
59 |
text += ", seed=" + str(seed)
|
60 |
prompt_segment = None
|
61 |
+
# prevent hacking
|
62 |
+
duration = min(duration, 720)
|
63 |
+
overlap = min(overlap, 15)
|
64 |
|
65 |
# Calculate the total number of segments
|
66 |
total_segments = max(math.ceil(duration / segment_duration),1)
|