asigalov61 commited on
Commit
7e5b8b6
1 Parent(s): 12382de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -115,7 +115,7 @@ def Harmonize_Melody(input_src_midi,
115
 
116
  model = AutoregressiveWrapper(model, ignore_index = PAD_IDX, pad_value=PAD_IDX)
117
 
118
- model_path = 'Melody_Harmonizer_Transformer_Trained_Model_7522_steps_0.6545_loss_0.7906_acc.pth'
119
 
120
  model.load_state_dict(torch.load(model_path))
121
 
@@ -158,7 +158,7 @@ def Harmonize_Melody(input_src_midi,
158
  1,
159
  filter_logits_fn=top_k,
160
  filter_kwargs={'k': model_top_k_sampling_value},
161
- temperature=0.9,
162
  return_prime=False,
163
  verbose=False)
164
 
@@ -176,7 +176,7 @@ def Harmonize_Melody(input_src_midi,
176
 
177
  #===============================================================================
178
 
179
- print('Harmonized', len(song), 'out of', len(mel_pitches), 'notes')
180
 
181
  print('Done!')
182
  print('=' * 70)
@@ -438,7 +438,7 @@ if __name__ == "__main__":
438
  gr.Markdown("## Select harmonization options")
439
 
440
  source_melody_transpose_value = gr.Slider(-6, 6, value=0, step=1, label="Source melody transpose value", info="You can transpose source melody by specified number of semitones if the original melody key does not harmonize well")
441
- model_top_k_sampling_value = gr.Slider(1, 50, value=15, step=1, label="Model sampling top_k value", info="Decreasing this value may produce better harmonization results in some cases")
442
  texture_harmonized_chords = gr.Checkbox(label="Texture harmonized chords", value=True, info="Texture harmonized chords for more pleasant listening")
443
  melody_MIDI_patch_number = gr.Slider(0, 127, value=40, step=1, label="Source melody MIDI patch number")
444
  harmonized_accompaniment_MIDI_patch_number = gr.Slider(0, 127, value=0, step=1, label="Harmonized accompaniment MIDI patch number")
@@ -467,7 +467,7 @@ if __name__ == "__main__":
467
 
468
  gr.Examples(
469
  [
470
- ["USSR Anthem Seed Melody.mid", 0, 15, True, 40, 0, 35],
471
  ],
472
  [input_src_midi,
473
  source_melody_transpose_value,
 
115
 
116
  model = AutoregressiveWrapper(model, ignore_index = PAD_IDX, pad_value=PAD_IDX)
117
 
118
+ model_path = 'Melody_Harmonizer_Transformer_Trained_Model_14961_steps_0.4155_loss_0.8664_acc.pth'
119
 
120
  model.load_state_dict(torch.load(model_path))
121
 
 
158
  1,
159
  filter_logits_fn=top_k,
160
  filter_kwargs={'k': model_top_k_sampling_value},
161
+ temperature=1.0,
162
  return_prime=False,
163
  verbose=False)
164
 
 
176
 
177
  #===============================================================================
178
 
179
+ print('Harmonized', len(song) // 2, 'out of', len(mel_pitches), 'notes')
180
 
181
  print('Done!')
182
  print('=' * 70)
 
438
  gr.Markdown("## Select harmonization options")
439
 
440
  source_melody_transpose_value = gr.Slider(-6, 6, value=0, step=1, label="Source melody transpose value", info="You can transpose source melody by specified number of semitones if the original melody key does not harmonize well")
441
+ model_top_k_sampling_value = gr.Slider(1, 50, value=25, step=1, label="Model sampling top_k value", info="Decreasing this value may produce better harmonization results in some cases")
442
  texture_harmonized_chords = gr.Checkbox(label="Texture harmonized chords", value=True, info="Texture harmonized chords for more pleasant listening")
443
  melody_MIDI_patch_number = gr.Slider(0, 127, value=40, step=1, label="Source melody MIDI patch number")
444
  harmonized_accompaniment_MIDI_patch_number = gr.Slider(0, 127, value=0, step=1, label="Harmonized accompaniment MIDI patch number")
 
467
 
468
  gr.Examples(
469
  [
470
+ ["USSR Anthem Seed Melody.mid", 0, 25, True, 40, 0, 35],
471
  ],
472
  [input_src_midi,
473
  source_melody_transpose_value,