Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -96,13 +96,21 @@ def ID_MIDI(input_midi):
|
|
96 |
print('=' * 70)
|
97 |
print('Processing...Please wait...')
|
98 |
|
|
|
|
|
|
|
|
|
99 |
if new_midi_md5hash in MIDID_database:
|
100 |
|
101 |
client = InferenceClient(api_key=HF_TOKEN)
|
102 |
|
103 |
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."
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
106 |
|
107 |
messages = [
|
108 |
{
|
@@ -128,7 +136,9 @@ def ID_MIDI(input_midi):
|
|
128 |
|
129 |
print('Done!')
|
130 |
print('=' * 70)
|
131 |
-
|
|
|
|
|
132 |
print(output_str)
|
133 |
print('=')
|
134 |
|
@@ -182,12 +192,16 @@ if __name__ == "__main__":
|
|
182 |
gr.Markdown("## MIDI identification results")
|
183 |
|
184 |
output_midi_md5 = gr.Textbox(label="Monster MIDI dataset md5 hash")
|
|
|
|
|
185 |
output_MIDID_results_table = gr.Dataframe(label="MIDID results table", wrap=True, col_count=(3, 'dynamic'))
|
186 |
|
187 |
run_event = submit.click(ID_MIDI, [input_midi,
|
188 |
],
|
189 |
-
[output_midi_md5,
|
190 |
-
|
|
|
|
|
191 |
])
|
192 |
|
193 |
app.queue().launch()
|
|
|
96 |
print('=' * 70)
|
97 |
print('Processing...Please wait...')
|
98 |
|
99 |
+
output_str = 'None'
|
100 |
+
output_midi_src_dataset= 'Unknown'
|
101 |
+
output_midi_path_str = 'None'
|
102 |
+
|
103 |
if new_midi_md5hash in MIDID_database:
|
104 |
|
105 |
client = InferenceClient(api_key=HF_TOKEN)
|
106 |
|
107 |
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."
|
108 |
|
109 |
+
output_midi_src_dataset = MIDID_database[new_midi_md5hash][0]['midi_dataset']
|
110 |
+
|
111 |
+
output_midi_path_str = MIDID_database[new_midi_md5hash][0]['midi_path']
|
112 |
+
|
113 |
+
data = 'Source MIDI dataset: ' + output_midi_src_dataset + '\n' + output_midi_path_str
|
114 |
|
115 |
messages = [
|
116 |
{
|
|
|
136 |
|
137 |
print('Done!')
|
138 |
print('=' * 70)
|
139 |
+
print('Source MIDI dataset', output_midi_src_dataset)
|
140 |
+
print('Original MIDI path string', output_midi_path_str)
|
141 |
+
print('=' * 70)
|
142 |
print(output_str)
|
143 |
print('=')
|
144 |
|
|
|
192 |
gr.Markdown("## MIDI identification results")
|
193 |
|
194 |
output_midi_md5 = gr.Textbox(label="Monster MIDI dataset md5 hash")
|
195 |
+
output_midi_src_dataset = gr.Textbox(label="Source MIDI dataset pretty name")
|
196 |
+
output_midi_path_str = gr.Textbox(label="Original MIDI raw path string")
|
197 |
output_MIDID_results_table = gr.Dataframe(label="MIDID results table", wrap=True, col_count=(3, 'dynamic'))
|
198 |
|
199 |
run_event = submit.click(ID_MIDI, [input_midi,
|
200 |
],
|
201 |
+
[output_midi_md5,
|
202 |
+
output_midi_src_dataset,
|
203 |
+
output_midi_path_str,
|
204 |
+
output_MIDID_results_table
|
205 |
])
|
206 |
|
207 |
app.queue().launch()
|