admin commited on
Commit
78aa5a4
·
1 Parent(s): a9a4b3c

upd repo name

Browse files
Files changed (2) hide show
  1. app.py +14 -2
  2. convert.py +1 -1
app.py CHANGED
@@ -14,7 +14,7 @@ from convert import midi2xml, xml2abc, xml2mxl, xml2jpg
14
 
15
  CACHE_DIR = "./flagged"
16
  WEIGHTS_PATH = (
17
- snapshot_download("Genius-Society/piano_transcription", cache_dir="./__pycache__")
18
  + "/CRNN_note_F1=0.9677_pedal_F1=0.9186.pth"
19
  )
20
 
@@ -140,6 +140,15 @@ def url_infer(audio_url: str):
140
 
141
  download_path = download_audio(audio_url, download_path)
142
 
 
 
 
 
 
 
 
 
 
143
  midi, title = audio2midi(download_path)
144
  if song_name:
145
  title = song_name
@@ -178,7 +187,10 @@ if __name__ == "__main__":
178
  with gr.Tab("Direct Link Mode"):
179
  gr.Interface(
180
  fn=url_infer,
181
- inputs=gr.Textbox(label="Input audio direct link"),
 
 
 
182
  outputs=[
183
  gr.Audio(label="Download audio", type="filepath"),
184
  gr.File(label="Download MIDI"),
 
14
 
15
  CACHE_DIR = "./flagged"
16
  WEIGHTS_PATH = (
17
+ snapshot_download("Genius-Society/piano_trans", cache_dir="./__pycache__")
18
  + "/CRNN_note_F1=0.9677_pedal_F1=0.9186.pth"
19
  )
20
 
 
140
 
141
  download_path = download_audio(audio_url, download_path)
142
 
143
+ elif audio_url.isalpha():
144
+ song_id = get_first_integer(audio_url)
145
+ audio_url = f"https://music.163.com/song/media/outer/url?id={song_id}.mp3"
146
+ song_name, free = music163_song_info(song_id)
147
+ if not free:
148
+ raise AttributeError("Unable to parse VIP songs")
149
+
150
+ download_path = download_audio(audio_url, download_path)
151
+
152
  midi, title = audio2midi(download_path)
153
  if song_name:
154
  title = song_name
 
187
  with gr.Tab("Direct Link Mode"):
188
  gr.Interface(
189
  fn=url_infer,
190
+ inputs=gr.Textbox(
191
+ label="Input audio direct link",
192
+ placeholder="https://music.163.com/#/song?id=",
193
+ ),
194
  outputs=[
195
  gr.Audio(label="Download audio", type="filepath"),
196
  gr.File(label="Download MIDI"),
convert.py CHANGED
@@ -36,7 +36,7 @@ if sys.platform.startswith("linux"):
36
  extra_dir = "squashfs-root"
37
  if not os.path.exists(apkname):
38
  download(
39
- url="https://www.modelscope.cn/studio/Genius-Society/piano_transcription/resolve/master/MuseScore.AppImage",
40
  directory="./",
41
  filename=apkname,
42
  )
 
36
  extra_dir = "squashfs-root"
37
  if not os.path.exists(apkname):
38
  download(
39
+ url="https://www.modelscope.cn/studio/Genius-Society/piano_trans/resolve/master/MuseScore.AppImage",
40
  directory="./",
41
  filename=apkname,
42
  )