fffiloni commited on
Commit
09934b1
·
verified ·
1 Parent(s): e07844d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -23
app.py CHANGED
@@ -80,10 +80,8 @@ def infer(prompt_in, chords, duration, bpms):
80
  musicgen = audiocraft.models.MusicGen.get_pretrained('./ckpt/musicongen') ### change this path
81
  musicgen.set_generation_params(duration=duration, extend_stride=duration//2, top_k = 250)
82
 
83
-
84
- # chords = [chords]
85
- chords = ['C G A:min F', 'A:min F C G', 'C F G F']
86
-
87
  descriptions = [prompt_in] * num_samples
88
 
89
  bpms = [bpms] * num_samples
@@ -121,26 +119,36 @@ css="""
121
  with gr.Blocks(css=css) as demo:
122
  with gr.Column(elem_id="col-container"):
123
  gr.Markdown("#MusiConGen")
124
- with gr.Row():
125
- with gr.Column():
126
- prompt_in = gr.Textbox(label="Music description", value="A laid-back blues shuffle with a relaxed tempo, warm guitar tones, and a comfortable groove, perfect for a slow dance or a night in. Instruments: electric guitar, bass, drums.")
127
- chords = gr.Textbox(label="Chords progression", value='C G A:min F')
128
- duration = gr.Slider(label="Sample duration", minimum=4, maximum=30, step=1, value=20)
129
- bpms = gr.Slider(label="BPMs", minimum=50, maximum=220, step=1, value=120)
130
- submit_btn = gr.Button("Submit")
131
- wav_out = gr.Audio(label="Wav Result")
132
- gr.Examples(
133
- label = "Audio description examples",
134
- examples = [
135
- ["A laid-back blues shuffle with a relaxed tempo, warm guitar tones, and a comfortable groove, perfect for a slow dance or a night in. Instruments: electric guitar, bass, drums."],
136
- ["A smooth acid jazz track with a laid-back groove, silky electric piano, and a cool bass, providing a modern take on jazz. Instruments: electric piano, bass, drums."],
137
- ["A classic rock n' roll tune with catchy guitar riffs, driving drums, and a pulsating bass line, reminiscent of the golden era of rock. Instruments: electric guitar, bass, drums."],
138
- ["A high-energy funk tune with slap bass, rhythmic guitar riffs, and a tight horn section, guaranteed to get you grooving. Instruments: bass, guitar, trumpet, saxophone, drums."],
139
- ["A heavy metal onslaught with double kick drum madness, aggressive guitar riffs, and an unrelenting bass, embodying the spirit of metal. Instruments: electric guitar, bass guitar, drums."]
140
- ],
141
- inputs = [prompt_in]
142
- )
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  submit_btn.click(
146
  fn = infer,
 
80
  musicgen = audiocraft.models.MusicGen.get_pretrained('./ckpt/musicongen') ### change this path
81
  musicgen.set_generation_params(duration=duration, extend_stride=duration//2, top_k = 250)
82
 
83
+ chords = [chords]
84
+
 
 
85
  descriptions = [prompt_in] * num_samples
86
 
87
  bpms = [bpms] * num_samples
 
119
  with gr.Blocks(css=css) as demo:
120
  with gr.Column(elem_id="col-container"):
121
  gr.Markdown("#MusiConGen")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
+ with gr.Column():
124
+ prompt_in = gr.Textbox(label="Music description", value="A laid-back blues shuffle with a relaxed tempo, warm guitar tones, and a comfortable groove, perfect for a slow dance or a night in. Instruments: electric guitar, bass, drums.")
125
+ chords = gr.Textbox(label="Chords progression", value='C G A:min F')
126
+ duration = gr.Slider(label="Sample duration", minimum=4, maximum=30, step=1, value=20)
127
+ bpms = gr.Slider(label="BPMs", minimum=50, maximum=220, step=1, value=120)
128
+ submit_btn = gr.Button("Submit")
129
+ wav_out = gr.Audio(label="Wav Result")
130
+ with gr.Row():
131
+ gr.Examples(
132
+ label = "Audio description examples",
133
+ examples = [
134
+ ["A laid-back blues shuffle with a relaxed tempo, warm guitar tones, and a comfortable groove, perfect for a slow dance or a night in. Instruments: electric guitar, bass, drums."],
135
+ ["A smooth acid jazz track with a laid-back groove, silky electric piano, and a cool bass, providing a modern take on jazz. Instruments: electric piano, bass, drums."],
136
+ ["A classic rock n' roll tune with catchy guitar riffs, driving drums, and a pulsating bass line, reminiscent of the golden era of rock. Instruments: electric guitar, bass, drums."],
137
+ ["A high-energy funk tune with slap bass, rhythmic guitar riffs, and a tight horn section, guaranteed to get you grooving. Instruments: bass, guitar, trumpet, saxophone, drums."],
138
+ ["A heavy metal onslaught with double kick drum madness, aggressive guitar riffs, and an unrelenting bass, embodying the spirit of metal. Instruments: electric guitar, bass guitar, drums."]
139
+ ],
140
+ inputs = [prompt_in]
141
+ )
142
+ gr.Examples(
143
+ label = "Chords progression examples",
144
+ examples = ['C G A:min F',
145
+ 'A:min F C G',
146
+ 'C F G F',
147
+ 'C A:min F G',
148
+ 'D:min G C A:min'
149
+ ],
150
+ inputs = [chords]
151
+ )
152
 
153
  submit_btn.click(
154
  fn = infer,