Spaces:
Sleeping
Sleeping
Update app.py (#4)
Browse files- Update app.py (52e8a76f3e59dac4e3455df62ac2ba0daf617e78)
Co-authored-by: Carlos Piruch <ec98@users.noreply.huggingface.co>
app.py
CHANGED
@@ -146,16 +146,17 @@ def main():
|
|
146 |
model=''
|
147 |
pesos=''
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
|
|
159 |
|
160 |
if uploaded_file and option is not None:
|
161 |
|
@@ -182,7 +183,9 @@ def main():
|
|
182 |
st.write(f"La duración del archivo MIDI subido es: {int(minutos)}:{int(segundos):02d}")
|
183 |
|
184 |
st.subheader("Modelo elegido:")
|
185 |
-
|
|
|
|
|
186 |
|
187 |
# Cargar modelo y pesos
|
188 |
with custom_object_scope({'mse_with_positive_pressure': mse_with_positive_pressure}):
|
@@ -260,19 +263,20 @@ def main():
|
|
260 |
st.title("Generador de notas musicales")
|
261 |
|
262 |
archivo_midi = open(out_file, 'rb').read()
|
263 |
-
|
264 |
-
st.
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
276 |
|
277 |
if __name__ == "__main__":
|
278 |
main()
|
|
|
146 |
model=''
|
147 |
pesos=''
|
148 |
|
149 |
+
with st.container(height = None, border = True):
|
150 |
+
option = st.selectbox(
|
151 |
+
"Elige con que modelo entrenar",
|
152 |
+
("Maestro", "Lakh"))
|
153 |
+
|
154 |
+
option_musica = st.selectbox(
|
155 |
+
"Elige instrumento a generar las melodias",
|
156 |
+
("Piano", "Chromatic Percussion", "Organ", "Guitar", "Bass", "Strings", "Ensemble", "Brass",
|
157 |
+
"Reed", "Pipe", "Synth Lead", "Synth Pad", "Synth Effects", "Ethnic", "Percussive", "Sound Effects"))
|
158 |
+
|
159 |
+
num_predictions = st.number_input("Ingrese el número de notas:", min_value=100, max_value=150, value=120, step=1)
|
160 |
|
161 |
if uploaded_file and option is not None:
|
162 |
|
|
|
183 |
st.write(f"La duración del archivo MIDI subido es: {int(minutos)}:{int(segundos):02d}")
|
184 |
|
185 |
st.subheader("Modelo elegido:")
|
186 |
+
|
187 |
+
with st.container(height = None, border = True):
|
188 |
+
st.write(option, f" de tipo instrumental ", option_musica)
|
189 |
|
190 |
# Cargar modelo y pesos
|
191 |
with custom_object_scope({'mse_with_positive_pressure': mse_with_positive_pressure}):
|
|
|
263 |
st.title("Generador de notas musicales")
|
264 |
|
265 |
archivo_midi = open(out_file, 'rb').read()
|
266 |
+
|
267 |
+
with st.container(height = None, border = True):
|
268 |
+
st.download_button(
|
269 |
+
label="Descargar MIDI",
|
270 |
+
data=archivo_midi,
|
271 |
+
file_name=out_file, # Nombre del archivo que se descargará
|
272 |
+
mime='audio/midi'
|
273 |
+
)
|
274 |
+
|
275 |
+
# Duracion del MIDI resultante
|
276 |
+
duracion_f = calcular_duracion_midi(out_file)
|
277 |
+
minutos_f, segundos_f = divmod(duracion_f, 60)
|
278 |
+
|
279 |
+
st.write(f"La duración del archivo MIDI resultante es: {int(minutos_f)}:{int(segundos_f):02d}")
|
280 |
|
281 |
if __name__ == "__main__":
|
282 |
main()
|