suric commited on
Commit
694f61a
·
1 Parent(s): 705e089

adjust the prompting

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +29 -4
  3. data/audio/old_town_road20sec.mp3 +3 -0
.gitattributes CHANGED
@@ -39,3 +39,4 @@ data/audio/twinkle_twinkle_little_stars_mozart.mp3 filter=lfs diff=lfs merge=lfs
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.mp3 !text !filter !merge !diff
41
  *.jpeg filter=lfs diff=lfs merge=lfs -text
 
 
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.mp3 !text !filter !merge !diff
41
  *.jpeg filter=lfs diff=lfs merge=lfs -text
42
+ data/audio/old_town_road20sec.mp3 filter=lfs diff=lfs merge=lfs -text
app.py CHANGED
@@ -80,7 +80,7 @@ _AUDIOCRAFT_MODELS = [
80
  def generate_prompt(difficulty, style):
81
  _DIFFICULTY_MAPPIN = {
82
  "Easy": "beginner player",
83
- "Medum": "player who has 2-3 years experience",
84
  "Hard": "player who has more than 4 years experiences",
85
  }
86
  prompt = "piano only music for a {} to practice with the touch of {}".format(
@@ -224,16 +224,22 @@ def UI():
224
  interactive=True,
225
  )
226
  style = gr.Radio(
227
- ["Jazz", "Classical Music", "Hip Hop", "Others"],
228
  value="Classical Music",
229
  label="music genre",
230
  interactive=True,
231
  )
232
- if style == "Others":
233
- style = gr.Textbox(label="Type your music genre")
 
 
 
 
 
234
  customize = gr.Checkbox(
235
  label="Customize the prompt", interactive=True, value=False
236
  )
 
237
  _init_prompt = generate_prompt(difficulty.value, style.value)
238
  prompt = gr.Textbox(
239
  label="",
@@ -246,6 +252,16 @@ def UI():
246
  inputs=[customize, difficulty, style],
247
  outputs=prompt,
248
  )
 
 
 
 
 
 
 
 
 
 
249
  print(prompt)
250
  with gr.Column():
251
  optimize = gr.Button(
@@ -352,6 +368,15 @@ def UI():
352
  16000,
353
  20,
354
  ],
 
 
 
 
 
 
 
 
 
355
  ],
356
  inputs=[melody, difficulty, sample_rate, duration],
357
  label="Audio Examples",
 
80
  def generate_prompt(difficulty, style):
81
  _DIFFICULTY_MAPPIN = {
82
  "Easy": "beginner player",
83
+ "Medium": "player who has 2-3 years experience",
84
  "Hard": "player who has more than 4 years experiences",
85
  }
86
  prompt = "piano only music for a {} to practice with the touch of {}".format(
 
224
  interactive=True,
225
  )
226
  style = gr.Radio(
227
+ ["Jazz", "Classical Music", "Hip Hop"],
228
  value="Classical Music",
229
  label="music genre",
230
  interactive=True,
231
  )
232
+
233
+ def update_prompt(difficulty, style):
234
+ return gr.Textbox(
235
+ label="",
236
+ value=generate_prompt(difficulty, style),
237
+ interactive=False,
238
+ visible=False)
239
  customize = gr.Checkbox(
240
  label="Customize the prompt", interactive=True, value=False
241
  )
242
+
243
  _init_prompt = generate_prompt(difficulty.value, style.value)
244
  prompt = gr.Textbox(
245
  label="",
 
252
  inputs=[customize, difficulty, style],
253
  outputs=prompt,
254
  )
255
+ difficulty.change(
256
+ update_prompt,
257
+ inputs=[difficulty, style],
258
+ outputs=prompt
259
+ )
260
+ style.change(
261
+ update_prompt,
262
+ inputs=[difficulty, style],
263
+ outputs=prompt
264
+ )
265
  print(prompt)
266
  with gr.Column():
267
  optimize = gr.Button(
 
368
  16000,
369
  20,
370
  ],
371
+ [
372
+ os.path.join(
373
+ os.path.dirname(__file__),
374
+ "./data/audio/old_town_road20sec.mp3",
375
+ ),
376
+ "Hard",
377
+ 32000,
378
+ 40,
379
+ ],
380
  ],
381
  inputs=[melody, difficulty, sample_rate, duration],
382
  label="Audio Examples",
data/audio/old_town_road20sec.mp3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05dbe19748ca9e39bd05d2b355414e7224d3928fbbbe1ec19dc9b246f26b8bfa
3
+ size 165605