Spaces:
Sleeping
Sleeping
asigalov61
commited on
Commit
•
eba33c8
1
Parent(s):
99b3591
Update app.py
Browse files
app.py
CHANGED
@@ -39,11 +39,13 @@ def run(search_prompt, mid=None, progress=gr.Progress()):
|
|
39 |
x.append(s[1] / mid_seq_ticks)
|
40 |
y.append(s[4])
|
41 |
c.append(colors[s[3]])
|
|
|
|
|
42 |
|
43 |
with open(f"output.mid", 'wb') as f:
|
44 |
f.write(MIDI.score2midi([mid_seq_ticks, mid_seq]))
|
45 |
audio = synthesis(MIDI.score2opus([mid_seq_ticks, mid_seq]), soundfont_path)
|
46 |
-
yield mdata, "output.mid", (44100, audio),
|
47 |
|
48 |
if __name__ == "__main__":
|
49 |
parser = argparse.ArgumentParser()
|
@@ -98,5 +100,6 @@ if __name__ == "__main__":
|
|
98 |
|
99 |
run_event = search_btn.click(run, [search_prompt],
|
100 |
[output_midi_seq, output_midi, output_audio, output_plot])
|
|
|
101 |
|
102 |
app.queue(1).launch(server_port=opt.port, share=opt.share, inbrowser=True)
|
|
|
39 |
x.append(s[1] / mid_seq_ticks)
|
40 |
y.append(s[4])
|
41 |
c.append(colors[s[3]])
|
42 |
+
|
43 |
+
plot = gr.ScatterPlot(x=x, y=y, color=c)
|
44 |
|
45 |
with open(f"output.mid", 'wb') as f:
|
46 |
f.write(MIDI.score2midi([mid_seq_ticks, mid_seq]))
|
47 |
audio = synthesis(MIDI.score2opus([mid_seq_ticks, mid_seq]), soundfont_path)
|
48 |
+
yield mdata, "output.mid", (44100, audio), plot
|
49 |
|
50 |
if __name__ == "__main__":
|
51 |
parser = argparse.ArgumentParser()
|
|
|
100 |
|
101 |
run_event = search_btn.click(run, [search_prompt],
|
102 |
[output_midi_seq, output_midi, output_audio, output_plot])
|
103 |
+
gr.show(output_plot)
|
104 |
|
105 |
app.queue(1).launch(server_port=opt.port, share=opt.share, inbrowser=True)
|