Spaces:
Sleeping
Sleeping
asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -24,11 +24,22 @@ in_space = os.getenv("SYSTEM") == "spaces"
|
|
24 |
# =================================================================================================
|
25 |
|
26 |
@spaces.GPU
|
27 |
-
def
|
28 |
print('=' * 70)
|
29 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
30 |
start_time = reqtime.time()
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
print('Loading model...')
|
33 |
|
34 |
SEQ_LEN = 3074
|
@@ -208,8 +219,11 @@ if __name__ == "__main__":
|
|
208 |
gr.Markdown(
|
209 |
"![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Bridge-Music-Transformer&style=flat)\n\n")
|
210 |
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
213 |
run_btn = gr.Button("generate", variant="primary")
|
214 |
|
215 |
gr.Markdown("## Generation results")
|
@@ -220,7 +234,7 @@ if __name__ == "__main__":
|
|
220 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
221 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
222 |
|
223 |
-
run_event = run_btn.click(
|
224 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
225 |
|
226 |
app.queue().launch()
|
|
|
24 |
# =================================================================================================
|
25 |
|
26 |
@spaces.GPU
|
27 |
+
def GenerateBridge(input_midi, input_start_note):
|
28 |
print('=' * 70)
|
29 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
30 |
start_time = reqtime.time()
|
31 |
|
32 |
+
|
33 |
+
print('=' * 70)
|
34 |
+
|
35 |
+
fn = os.path.basename(input_midi.name)
|
36 |
+
fn1 = fn.split('.')[0]
|
37 |
+
|
38 |
+
print('-' * 70)
|
39 |
+
print('Input file name:', fn)
|
40 |
+
print('Start note', input_start_note)
|
41 |
+
print('-' * 70)
|
42 |
+
|
43 |
print('Loading model...')
|
44 |
|
45 |
SEQ_LEN = 3074
|
|
|
219 |
gr.Markdown(
|
220 |
"![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Bridge-Music-Transformer&style=flat)\n\n")
|
221 |
|
222 |
+
gr.Markdown("## Upload your MIDI or select a sample example MIDI below")
|
223 |
+
gr.Markdown("### Please note that the MIDI must have at least 615 notes for this demo to work")
|
224 |
+
|
225 |
+
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
226 |
+
input_start_note = gr.Slider(0, 205, value=0, step=1, label="Start note number")
|
227 |
run_btn = gr.Button("generate", variant="primary")
|
228 |
|
229 |
gr.Markdown("## Generation results")
|
|
|
234 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
235 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
236 |
|
237 |
+
run_event = run_btn.click(GenerateBridge, [input_midi, input_start_note],
|
238 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
239 |
|
240 |
app.queue().launch()
|