Spaces:
Runtime error
Runtime error
floriangardin
commited on
Commit
•
f0a10e0
1
Parent(s):
c915d01
choose chord progression with prompt
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def inner_loop(nb_tokens, temperature, chord_progression, tempo, midi_file, bar_
|
|
31 |
topp=top_p,
|
32 |
rng_seed=seed
|
33 |
)
|
34 |
-
elif score is not None:
|
35 |
# Generate using the uploaded MIDI file as a prompt
|
36 |
generated_score = ml.predict(
|
37 |
score=score, # Use the uploaded MIDI as the score prompt
|
@@ -44,6 +44,7 @@ def inner_loop(nb_tokens, temperature, chord_progression, tempo, midi_file, bar_
|
|
44 |
# Generate with specific chord progression
|
45 |
generated_score = ml.predict_chords(
|
46 |
chord_progression,
|
|
|
47 |
time_signature=(4, 4),
|
48 |
temperature=temperature,
|
49 |
topp=top_p,
|
@@ -80,10 +81,10 @@ iface = gr.Interface(
|
|
80 |
inputs=[
|
81 |
gr.Number(label="Number of Tokens", value=1024, minimum=256, maximum=2048, step=256),
|
82 |
gr.Slider(label="Temperature", value=0.9, minimum=0.1, maximum=1.0, step=0.1),
|
83 |
-
gr.Textbox(label="Chord Progression", placeholder="Am CM Dm/F E7 Am", lines=2, value=""),
|
84 |
gr.Slider(label="Tempo", value=120, minimum=60, maximum=240, step=1),
|
85 |
gr.File(label="Upload MIDI File", type="filepath", file_types=[".mid", ".midi"]),
|
86 |
-
gr.Textbox(label="Bar Range", placeholder="0-4", value="0-4")
|
87 |
],
|
88 |
outputs=[
|
89 |
gr.Audio(label="Generated Music"),
|
|
|
31 |
topp=top_p,
|
32 |
rng_seed=seed
|
33 |
)
|
34 |
+
elif score is not None and chord_progression.strip() == "":
|
35 |
# Generate using the uploaded MIDI file as a prompt
|
36 |
generated_score = ml.predict(
|
37 |
score=score, # Use the uploaded MIDI as the score prompt
|
|
|
44 |
# Generate with specific chord progression
|
45 |
generated_score = ml.predict_chords(
|
46 |
chord_progression,
|
47 |
+
score=score, # Use the uploaded MIDI as the score prompt
|
48 |
time_signature=(4, 4),
|
49 |
temperature=temperature,
|
50 |
topp=top_p,
|
|
|
81 |
inputs=[
|
82 |
gr.Number(label="Number of Tokens", value=1024, minimum=256, maximum=2048, step=256),
|
83 |
gr.Slider(label="Temperature", value=0.9, minimum=0.1, maximum=1.0, step=0.1),
|
84 |
+
gr.Textbox(label="Chord Progression (Optional)", placeholder="Am CM Dm/F E7 Am", lines=2, value=""),
|
85 |
gr.Slider(label="Tempo", value=120, minimum=60, maximum=240, step=1),
|
86 |
gr.File(label="Upload MIDI File", type="filepath", file_types=[".mid", ".midi"]),
|
87 |
+
gr.Textbox(label="Bar Range of input file", placeholder="0-4", value="0-4")
|
88 |
],
|
89 |
outputs=[
|
90 |
gr.Audio(label="Generated Music"),
|