AlekseyKorshuk commited on
Commit
6913c85
1 Parent(s): f19a6a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -36,9 +36,9 @@ st.sidebar.markdown(ABOUT_TEXT)
36
  st.sidebar.markdown(CONTACT_TEXT)
37
 
38
 
39
- def inference(audio, num_epoch):
40
  generator = Generator()
41
- output_midi_data = generator(audio, num_epoch=int(num_epoch))[0]
42
  name = uuid.uuid4()
43
  output_midi_data.write(f'{name}.mid')
44
  fs = FluidSynth("font.sf2")
@@ -79,6 +79,11 @@ num_epoch = st.number_input("Number of epochs:",
79
  value=10,
80
  )
81
 
 
 
 
 
 
82
  generate_image_button = st.button("Generate")
83
 
84
  if generate_image_button:
@@ -86,7 +91,7 @@ if generate_image_button:
86
  if uploaded_file is not None:
87
  input_file = uploaded_file.name
88
  with st.spinner(text=f"Generating, this may take some time..."):
89
- before, after = inference(input_file, num_epoch)
90
  st.markdown("Before:")
91
  st.audio(before)
92
  st.markdown("After:")
 
36
  st.sidebar.markdown(CONTACT_TEXT)
37
 
38
 
39
+ def inference(audio, num_epoch, tonic_name):
40
  generator = Generator()
41
+ output_midi_data = generator(audio, num_epoch=int(num_epoch), tonic=tonic_name)[0]
42
  name = uuid.uuid4()
43
  output_midi_data.write(f'{name}.mid')
44
  fs = FluidSynth("font.sf2")
 
79
  value=10,
80
  )
81
 
82
+ tonic_name = st.selectbox(
83
+ 'Select tonic:',
84
+ ["minor", "major"]
85
+ )
86
+
87
  generate_image_button = st.button("Generate")
88
 
89
  if generate_image_button:
 
91
  if uploaded_file is not None:
92
  input_file = uploaded_file.name
93
  with st.spinner(text=f"Generating, this may take some time..."):
94
+ before, after = inference(input_file, num_epoch, tonic_name)
95
  st.markdown("Before:")
96
  st.audio(before)
97
  st.markdown("After:")