Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -102,6 +102,14 @@ def ID_MIDI(input_midi):
|
|
102 |
output_midi_records_count = 0
|
103 |
output_midi_src_dataset= 'Unknown'
|
104 |
output_midi_path_str = 'None'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
if new_midi_md5hash in midid_md5_hashes:
|
107 |
|
@@ -117,22 +125,16 @@ def ID_MIDI(input_midi):
|
|
117 |
|
118 |
output_midi_path_str = output_entry[1]
|
119 |
|
120 |
-
else:
|
121 |
-
|
122 |
-
raw_score = TMIDIX.midi2single_track_ms_score(fdata)
|
123 |
-
escore_notes = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
|
124 |
-
escore_notes = TMIDIX.augment_enhanced_score_notes(escore_notes, sort_drums_last=True)
|
125 |
-
|
126 |
-
output_midi_src_dataset = 'unknown'
|
127 |
-
output_midi_path_str = TMIDIX.escore_notes_to_text_description(escore_notes)
|
128 |
-
|
129 |
client = InferenceClient(api_key=HF_TOKEN)
|
130 |
|
131 |
prompt = "Please create a summary table for a MIDI file based on the following keywords strings, best possible description and best possible summary fields. Please respond with the table only. Do not say anything else. Thank you."
|
132 |
|
133 |
-
data = 'Source MIDI dataset: ' + output_midi_src_dataset + '\n'
|
134 |
-
data += '
|
135 |
-
data += output_midi_path_str
|
|
|
|
|
|
|
136 |
|
137 |
messages = [
|
138 |
{
|
|
|
102 |
output_midi_records_count = 0
|
103 |
output_midi_src_dataset= 'Unknown'
|
104 |
output_midi_path_str = 'None'
|
105 |
+
|
106 |
+
raw_score = TMIDIX.midi2single_track_ms_score(fdata)
|
107 |
+
escore_notes = TMIDIX.advanced_score_processor(raw_score, return_enhanced_score_notes=True)[0]
|
108 |
+
escore_notes = TMIDIX.augment_enhanced_score_notes(escore_notes, sort_drums_last=True)
|
109 |
+
|
110 |
+
output_midi_src_dataset = 'unknown'
|
111 |
+
output_midi_path_str = 'none'
|
112 |
+
song_description = TMIDIX.escore_notes_to_text_description(escore_notes)
|
113 |
|
114 |
if new_midi_md5hash in midid_md5_hashes:
|
115 |
|
|
|
125 |
|
126 |
output_midi_path_str = output_entry[1]
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
client = InferenceClient(api_key=HF_TOKEN)
|
129 |
|
130 |
prompt = "Please create a summary table for a MIDI file based on the following keywords strings, best possible description and best possible summary fields. Please respond with the table only. Do not say anything else. Thank you."
|
131 |
|
132 |
+
data = 'Source MIDI dataset: ' + output_midi_src_dataset + '\n\n'
|
133 |
+
data += 'MIDI keywords strings:' + '\n'
|
134 |
+
data += output_midi_path_str + '\n\n'
|
135 |
+
data += 'Music description:' + '\n'
|
136 |
+
data += song_description
|
137 |
+
|
138 |
|
139 |
messages = [
|
140 |
{
|