Katpeeler commited on
Commit
186045c
·
1 Parent(s): 36191eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -19
app.py CHANGED
@@ -131,25 +131,10 @@ def generation(text):
131
  generated_sequence = tokenizer.decode(generated_ids[0])
132
  return generated_sequence
133
 
134
- #title = "Music gen with GPT-2"
135
- #title2 = "Midi token generation"
136
-
137
- #iface = gr.Interface(
138
- # fn=process,
139
- # inputs=["text"],
140
- # outputs=['audio'],
141
- # title=title,
142
- #examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]],
143
- # article="This demo is inspired in the notebook from https://huggingface.co/TristanBehrens/js-fakes-4bars."
144
- #)
145
-
146
- #iface2 = gr.Interface(
147
- # fn=generation,
148
- # inputs=["text"],
149
- # outputs=["text"],
150
- # title=title2,
151
- # article="This will generate the encoded text that represents Midi language."
152
- #)
153
 
154
 
155
  with gr.Blocks() as demo:
@@ -159,9 +144,14 @@ with gr.Blocks() as demo:
159
  text_output = gr.Textbox()
160
  text_button = gr.Button("generate tokens")
161
  with gr.Tab("Audio generation"):
 
 
162
  text_input = gr.Textbox()
163
  audio_output = gr.Audio()
164
  audio_button = gr.Button("generate audio")
 
 
 
165
 
166
  text_button.click(generation, inputs=text_input, outputs=text_output)
167
  audio_button.click(process, inputs=text_input, outputs=audio_output)
 
131
  generated_sequence = tokenizer.decode(generated_ids[0])
132
  return generated_sequence
133
 
134
+
135
+ def identity(x, state):
136
+ state += 1
137
+ return x, state, state
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
 
140
  with gr.Blocks() as demo:
 
144
  text_output = gr.Textbox()
145
  text_button = gr.Button("generate tokens")
146
  with gr.Tab("Audio generation"):
147
+ slider = gr.Slider(1, 100, step=1)
148
+ state = gr.State(value=1)
149
  text_input = gr.Textbox()
150
  audio_output = gr.Audio()
151
  audio_button = gr.Button("generate audio")
152
+ with gr.Row():
153
+ number = gr.Number(label="On release")
154
+ slider.release(identity, inputs=[slider, state], outputs=[number, state], api_name="predict")
155
 
156
  text_button.click(generation, inputs=text_input, outputs=text_output)
157
  audio_button.click(process, inputs=text_input, outputs=audio_output)