Katpeeler commited on
Commit
f277159
·
1 Parent(s): 4b89ad2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -110,8 +110,8 @@ def empty_note_sequence(qpm=120.0, total_time=0.0):
110
  return note_sequence
111
 
112
  def process(text):
113
- preset_text = sentence_built_text
114
- input_ids = tokenizer.encode(text, return_tensors="pt")
115
  generated_ids = model.generate(input_ids, max_length=500)
116
  generated_sequence = tokenizer.decode(generated_ids[0])
117
 
@@ -138,7 +138,7 @@ def identity(x, state):
138
  return x, state, state
139
 
140
  def sentence_builder(quantity1, quantity2):
141
- return f"""PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST={quantity1} BAR_START NOTE_ON={quantity2}"""
142
 
143
  with gr.Blocks() as demo:
144
  gr.Markdown("Midi Generation")
@@ -152,20 +152,13 @@ with gr.Blocks() as demo:
152
  audio_button = gr.Button("generate audio")
153
  sentence_builder,
154
  [
155
- slider1 = gr.Slider(1, 100, value=25, step=1),
156
- slider2 = gr.Slider(1, 100, value=40, step=1)
157
  ]
158
- with gr.Row():
159
- number1 = gr.Number(label="On release")
160
- number2 = gr.Number(label="On release")
161
- slider1.release(identity, inputs=[slider], outputs=[number1], api_name="predict")
162
- slider2.release(identity, inputs=[slider2], outputs=[number2], api_name="predict")
163
 
164
  text_button.click(generation, inputs=text_input, outputs=text_output)
165
  audio_button.click(process, inputs=text_input, outputs=audio_output)
166
 
167
 
168
  if __name__ == "__main__":
169
- demo.launch()
170
-
171
- #iface.launch(debug=True)
 
110
  return note_sequence
111
 
112
  def process(text):
113
+ preset_text = created_sentence
114
+ input_ids = tokenizer.encode(preset_text, return_tensors="pt")
115
  generated_ids = model.generate(input_ids, max_length=500)
116
  generated_sequence = tokenizer.decode(generated_ids[0])
117
 
 
138
  return x, state, state
139
 
140
  def sentence_builder(quantity1, quantity2):
141
+ created_sentence = f"""PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST={quantity1} BAR_START NOTE_ON={quantity2}"""
142
 
143
  with gr.Blocks() as demo:
144
  gr.Markdown("Midi Generation")
 
152
  audio_button = gr.Button("generate audio")
153
  sentence_builder,
154
  [
155
+ gr.Slider(1, 100, value=25, step=1, label="Inst number", info="Choose between 1 and 100"),
156
+ gr.Slider(1, 100, value=40, step=1, label="Note number", info="Choose between 1 and 100")
157
  ]
 
 
 
 
 
158
 
159
  text_button.click(generation, inputs=text_input, outputs=text_output)
160
  audio_button.click(process, inputs=text_input, outputs=audio_output)
161
 
162
 
163
  if __name__ == "__main__":
164
+ demo.launch()