asigalov61 commited on
Commit
7724541
·
verified ·
1 Parent(s): 5fdc7da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -61,17 +61,11 @@ def ID_MIDI(input_midi):
61
  #=======================================================
62
  # START PROCESSING
63
 
64
- raw_score = TMIDIX.midi2single_track_ms_score(fdata)
65
 
66
- escore = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
67
-
68
- escore = TMIDIX.augment_enhanced_score_notes(escore, timings_divider=1)
69
-
70
- first_note_index = [e[0] for e in raw_score[1]].index('note')
71
-
72
- cscore = TMIDIX.chordify_score([1000, escore])
73
 
74
- meta_data = raw_score[1][:first_note_index] + [escore[0]] + [escore[-1]] + [raw_score[1][-1]]
75
 
76
  print('Done!')
77
  print('=' * 70)
@@ -79,13 +73,13 @@ def ID_MIDI(input_midi):
79
  print('=' * 70)
80
  print('Processing...Please wait...')
81
 
82
- if input_midi_md5hash in MIDID_database:
83
 
84
  client = InferenceClient(api_key=HF_TOKEN)
85
 
86
  prompt = "Please create a summary table for a MIDI file based on the following keywords strings. Please add best possible description and best possible summary fields. Please respond with the table only. Do not say anything else. Thank you."
87
 
88
- data = MIDID_database[input_midi_md5hash][0]['midi_path']
89
 
90
  messages = [
91
  {
 
61
  #=======================================================
62
  # START PROCESSING
63
 
64
+ new_midi_data = TMIDIX.score2midi(TMIDIX.midi2score(fdata))
65
 
66
+ new_midi_md5hash = hashlib.md5(new_midi_data).hexdigest()
 
 
 
 
 
 
67
 
68
+ print('New md5 hash:', new_midi_md5hash)
69
 
70
  print('Done!')
71
  print('=' * 70)
 
73
  print('=' * 70)
74
  print('Processing...Please wait...')
75
 
76
+ if new_midi_md5hash in MIDID_database:
77
 
78
  client = InferenceClient(api_key=HF_TOKEN)
79
 
80
  prompt = "Please create a summary table for a MIDI file based on the following keywords strings. Please add best possible description and best possible summary fields. Please respond with the table only. Do not say anything else. Thank you."
81
 
82
+ data = MIDID_database[new_midi_md5hash][0]['midi_path']
83
 
84
  messages = [
85
  {