skytnt commited on
Commit
22dc587
1 Parent(s): 5c5b5ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -180,6 +180,7 @@ if __name__ == "__main__":
180
  parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
181
  parser.add_argument("--port", type=int, default=7860, help="gradio server port")
182
  parser.add_argument("--device", type=str, default="cpu", help="device to run model")
 
183
  soundfont_path = hf_hub_download(repo_id="skytnt/midi-model", filename="soundfont.sf2")
184
  model_path = hf_hub_download(repo_id="skytnt/midi-model", filename="model.ckpt")
185
  opt = parser.parse_args()
@@ -192,6 +193,11 @@ if __name__ == "__main__":
192
 
193
  app = gr.Blocks()
194
  with app:
 
 
 
 
 
195
  tab_select = gr.Variable(value=0)
196
  with gr.Tabs():
197
  with gr.TabItem("instrument prompt") as tab1:
@@ -207,7 +213,8 @@ if __name__ == "__main__":
207
 
208
  tab1.select(lambda: 0, None, tab_select, queue=False)
209
  tab2.select(lambda: 1, None, tab_select, queue=False)
210
- input_gen_events = gr.Slider(label="generate n midi events", minimum=1, maximum=512, step=1, value=512)
 
211
  input_temp = gr.Slider(label="temperature", minimum=0.1, maximum=1.2, step=0.01, value=1)
212
  input_top_p = gr.Slider(label="top p", minimum=0.1, maximum=1, step=0.01, value=0.97)
213
  input_top_k = gr.Slider(label="top k", minimum=1, maximum=50, step=1, value=20)
 
180
  parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
181
  parser.add_argument("--port", type=int, default=7860, help="gradio server port")
182
  parser.add_argument("--device", type=str, default="cpu", help="device to run model")
183
+ parser.add_argument("--max-gen", type=int, default=512, help="max")
184
  soundfont_path = hf_hub_download(repo_id="skytnt/midi-model", filename="soundfont.sf2")
185
  model_path = hf_hub_download(repo_id="skytnt/midi-model", filename="model.ckpt")
186
  opt = parser.parse_args()
 
193
 
194
  app = gr.Blocks()
195
  with app:
196
+ gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Midi Composer</h1>")
197
+ gr.Markdown("![Visitors](https://api.visitorbadge.io/api/visitors?path=skytnt.midi-composer&style=flat)\n\n"
198
+ "Midi event transformer for music generation\n\n"
199
+ "Demo for [SkyTNT/midi-model](https://github.com/SkyTNT/midi-model)")
200
+
201
  tab_select = gr.Variable(value=0)
202
  with gr.Tabs():
203
  with gr.TabItem("instrument prompt") as tab1:
 
213
 
214
  tab1.select(lambda: 0, None, tab_select, queue=False)
215
  tab2.select(lambda: 1, None, tab_select, queue=False)
216
+ input_gen_events = gr.Slider(label="generate n midi events", minimum=1, maximum=opt.max_gen,
217
+ step=1, value=opt.max_gen)
218
  input_temp = gr.Slider(label="temperature", minimum=0.1, maximum=1.2, step=0.01, value=1)
219
  input_top_p = gr.Slider(label="top p", minimum=0.1, maximum=1, step=0.01, value=0.97)
220
  input_top_k = gr.Slider(label="top k", minimum=1, maximum=50, step=1, value=20)