asigalov61 commited on
Commit
b3d72a4
·
verified ·
1 Parent(s): ee46fa2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -62,7 +62,14 @@ def format_table_data(data_string):
62
 
63
  #==========================================================================================================
64
 
65
- def ID_MIDI(input_midi):
 
 
 
 
 
 
 
66
 
67
  print('*' * 70)
68
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
@@ -83,6 +90,7 @@ def ID_MIDI(input_midi):
83
  print('=' * 70)
84
  print('Input MIDI file name:', fn)
85
  print('Input MIDI md5 hash', input_midi_md5hash)
 
86
  print('=' * 70)
87
  print('Processing MIDI...Please wait...')
88
 
@@ -156,7 +164,7 @@ def ID_MIDI(input_midi):
156
 
157
  completion = client.chat.completions.create(
158
  #model="Qwen/Qwen2.5-72B-Instruct",
159
- model="mistralai/Mistral-Nemo-Instruct-2407",
160
  messages=messages,
161
  max_tokens=500
162
  )
@@ -228,6 +236,7 @@ if __name__ == "__main__":
228
  gr.Markdown("## Upload your MIDI")
229
 
230
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"], type="filepath")
 
231
 
232
  submit = gr.Button("Identify MIDI", variant="primary")
233
 
@@ -239,7 +248,8 @@ if __name__ == "__main__":
239
  output_midi_path_str = gr.Textbox(label="Original MIDI raw path string")
240
  output_MIDID_results_table = gr.Dataframe(label="MIDID database results table", wrap=True, col_count=(3, 'dynamic'))
241
 
242
- run_event = submit.click(ID_MIDI, [input_midi,
 
243
  ],
244
  [output_midi_md5,
245
  output_midi_records_count,
 
62
 
63
  #==========================================================================================================
64
 
65
+
66
+ MODELS = {'Llama 3.3 70B Instruct': 'meta-llama/Llama-3.3-70B-Instruct',
67
+ 'Mistral Nemo Instruct 2407': 'mistralai/Mistral-Nemo-Instruct-2407'
68
+ }
69
+
70
+ #==========================================================================================================
71
+
72
+ def ID_MIDI(input_midi, input_model):
73
 
74
  print('*' * 70)
75
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
 
90
  print('=' * 70)
91
  print('Input MIDI file name:', fn)
92
  print('Input MIDI md5 hash', input_midi_md5hash)
93
+ print('Input model:', input_model)
94
  print('=' * 70)
95
  print('Processing MIDI...Please wait...')
96
 
 
164
 
165
  completion = client.chat.completions.create(
166
  #model="Qwen/Qwen2.5-72B-Instruct",
167
+ model=MODELS[input_model],
168
  messages=messages,
169
  max_tokens=500
170
  )
 
236
  gr.Markdown("## Upload your MIDI")
237
 
238
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"], type="filepath")
239
+ input_model = gr.Dropdown(['Llama 3.3 70B Instruct', 'Mistral Nemo Instruct 2407'], value='Llama 3.3 70B Instruct', label='Select model')
240
 
241
  submit = gr.Button("Identify MIDI", variant="primary")
242
 
 
248
  output_midi_path_str = gr.Textbox(label="Original MIDI raw path string")
249
  output_MIDID_results_table = gr.Dataframe(label="MIDID database results table", wrap=True, col_count=(3, 'dynamic'))
250
 
251
+ run_event = submit.click(ID_MIDI, [input_midi,
252
+ input_model
253
  ],
254
  [output_midi_md5,
255
  output_midi_records_count,