Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -146,6 +146,10 @@ def main():
|
|
146 |
"Elige con que modelo entrenar",
|
147 |
("Maestro", "Lakh"))
|
148 |
|
|
|
|
|
|
|
|
|
149 |
|
150 |
|
151 |
if uploaded_file and option is not None:
|
@@ -177,7 +181,44 @@ def main():
|
|
177 |
|
178 |
# Convertir MIDI generado por el modelo a archivo WAV
|
179 |
pm = pretty_midi.PrettyMIDI(sample_file)
|
180 |
-
instrument_name =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
raw_notes = midi_to_notes(sample_file)
|
182 |
key_order = ['pitch', 'step', 'duration']
|
183 |
seq_length = 25
|
|
|
146 |
"Elige con que modelo entrenar",
|
147 |
("Maestro", "Lakh"))
|
148 |
|
149 |
+
option_musica = st.selectbox(
|
150 |
+
"Elige instrumento a generar las melodias",
|
151 |
+
("Piano", "Chromatic Percussion", "Organ", "Guitar", "Bass", "Strings", "Ensemble", "Brass",
|
152 |
+
"Reed", "Pipe", "Synth Lead", "Synth Pad", "Synth Effects", "Ethnic", "Percussive", "Sound Effects"))
|
153 |
|
154 |
|
155 |
if uploaded_file and option is not None:
|
|
|
181 |
|
182 |
# Convertir MIDI generado por el modelo a archivo WAV
|
183 |
pm = pretty_midi.PrettyMIDI(sample_file)
|
184 |
+
instrument_name = ""
|
185 |
+
|
186 |
+
if option_musica is not None:
|
187 |
+
if option_musica=="Piano":
|
188 |
+
instrument_name="Acoustic Grand Piano"
|
189 |
+
elif option_musica=="Chromatic Percussion":
|
190 |
+
instrument_name="Celesta"
|
191 |
+
elif option_musica=="Organ":
|
192 |
+
instrument_name="Hammond Organ"
|
193 |
+
elif option_musica=="Guitar":
|
194 |
+
instrument_name="Acoustic Guitar (nylon)"
|
195 |
+
elif option_musica=="Bass":
|
196 |
+
instrument_name="Acoustic Bass"
|
197 |
+
elif option_musica=="Strings":
|
198 |
+
instrument_name="Violin"
|
199 |
+
elif option_musica=="Ensemble":
|
200 |
+
instrument_name="String Ensemble 1"
|
201 |
+
elif option_musica=="Brass":
|
202 |
+
instrument_name="Trumpet"
|
203 |
+
elif option_musica=="Reed":
|
204 |
+
instrument_name="Soprano Sax"
|
205 |
+
elif option_musica=="Pipe":
|
206 |
+
instrument_name="Piccolo"
|
207 |
+
elif option_musica=="Synth Lead":
|
208 |
+
instrument_name="Lead 2 (sawtooth)"
|
209 |
+
elif option_musica=="Synth Pad":
|
210 |
+
instrument_name="Pad 2 (warm)"
|
211 |
+
elif option_musica=="Synth Effects":
|
212 |
+
instrument_name="FX 2 (soundtrack)"
|
213 |
+
elif option_musica=="Ethnic":
|
214 |
+
instrument_name="Banjo"
|
215 |
+
elif option_musica=="Percussive":
|
216 |
+
instrument_name="Melodic Tom"
|
217 |
+
elif option_musica=="Sound Effects":
|
218 |
+
instrument_name="Guitar Fret Noise"
|
219 |
+
else:
|
220 |
+
instrument_name=pretty_midi.program_to_instrument_name(pm.instruments[0].program)
|
221 |
+
|
222 |
raw_notes = midi_to_notes(sample_file)
|
223 |
key_order = ['pitch', 'step', 'duration']
|
224 |
seq_length = 25
|