Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -61,17 +61,11 @@ def ID_MIDI(input_midi):
|
|
61 |
#=======================================================
|
62 |
# START PROCESSING
|
63 |
|
64 |
-
|
65 |
|
66 |
-
|
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 |
-
|
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
|
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[
|
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 |
{
|