asigalov61 commited on
Commit
de46ee3
1 Parent(s): b402d93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -14
app.py CHANGED
@@ -7,15 +7,14 @@ import numpy as np
7
  import onnxruntime as rt
8
  import tqdm
9
  import json
10
- from huggingface_hub import hf_hub_download
11
 
 
12
  import TMIDIX
13
 
14
  in_space = os.getenv("SYSTEM") == "spaces"
15
 
16
  providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
17
 
18
-
19
  def load_javascript(dir="javascript"):
20
  scripts_list = glob.glob(f"{dir}/*.js")
21
  javascript = ""
@@ -55,15 +54,24 @@ if __name__ == "__main__":
55
  parser.add_argument("--max-gen", type=int, default=1024, help="max")
56
  opt = parser.parse_args()
57
 
58
- app = gr.Blocks()
59
- with app:
60
- gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Midi Composer</h1>")
61
- gr.Markdown("![Visitors](https://api.visitorbadge.io/api/visitors?path=skytnt.midi-composer&style=flat)\n\n"
62
- "Midi event transformer for music generation\n\n"
63
- "Demo for [SkyTNT/midi-model](https://github.com/SkyTNT/midi-model)\n\n"
64
- "[Open In Colab]"
65
- "(https://colab.research.google.com/github/SkyTNT/midi-model/blob/main/demo.ipynb)"
66
- " for faster running and longer generation"
67
- )
68
-
69
- app.queue(2).launch(server_port=opt.port, share=opt.share, inbrowser=True)
 
 
 
 
 
 
 
 
 
 
7
  import onnxruntime as rt
8
  import tqdm
9
  import json
 
10
 
11
+ from midi_synthesizer import synthesis
12
  import TMIDIX
13
 
14
  in_space = os.getenv("SYSTEM") == "spaces"
15
 
16
  providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
17
 
 
18
  def load_javascript(dir="javascript"):
19
  scripts_list = glob.glob(f"{dir}/*.js")
20
  javascript = ""
 
54
  parser.add_argument("--max-gen", type=int, default=1024, help="max")
55
  opt = parser.parse_args()
56
 
57
+
58
+ providers = ['CUDAExecutionProvider', 'CPUExecutionProvider']
59
+
60
+ session = rt.InferenceSession('Allegro_Music_Transformer_Small_Trained_Model_56000_steps_0.9399_loss_0.7374_acc.onnx', providers=providers)
61
+
62
+
63
+ app = gr.Blocks()
64
+ with app:
65
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Midi Composer</h1>")
66
+ gr.Markdown("![Visitors](https://api.visitorbadge.io/api/visitors?path=skytnt.midi-composer&style=flat)\n\n"
67
+ "Midi event transformer for music generation\n\n"
68
+ "Demo for [SkyTNT/midi-model](https://github.com/SkyTNT/midi-model)\n\n"
69
+ "[Open In Colab]"
70
+ "(https://colab.research.google.com/github/SkyTNT/midi-model/blob/main/demo.ipynb)"
71
+ " for faster running and longer generation"
72
+ )
73
+
74
+ js_msg = JSMsgReceiver()
75
+ tab_select = gr.Variable(value=0)
76
+
77
+ app.queue(2).launch(server_port=opt.port, share=opt.share, inbrowser=True)