fffiloni commited on
Commit
2319c67
1 Parent(s): ad3a1b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,22 +1,26 @@
1
  import gradio as gr
2
- from audiocraft.data.audio import audio_write
3
- import audiocraft.models
4
  import numpy as np
5
  import pandas as pd
6
  import os
7
  import torch
8
 
 
 
 
 
 
 
9
  # download models
10
  huggingface_hub.hf_hub_download(
11
  repo_id='Cyan0731/MusiConGen',
12
  filename='compression_state_dict.bin',
13
- local_dir='./audiocraft/ckpt/musicongen'
14
  )
15
 
16
  huggingface_hub.hf_hub_download(
17
  repo_id='Cyan0731/MusiConGen',
18
  filename='state_dict.bin',
19
- local_dir='./audiocraft/ckpt/musicongen'
20
  )
21
 
22
  def print_directory_contents(path):
@@ -41,7 +45,7 @@ def infer(text):
41
 
42
 
43
  # load your model
44
- musicgen = audiocraft.models.MusicGen.get_pretrained('./audiocraft/ckpt/musicongen') ### change this path
45
  musicgen.set_generation_params(duration=duration, extend_stride=duration//2, top_k = 250)
46
 
47
 
 
1
  import gradio as gr
 
 
2
  import numpy as np
3
  import pandas as pd
4
  import os
5
  import torch
6
 
7
+ # Change the directory
8
+ os.chdir('./audiocraft')
9
+ from audiocraft.data.audio import audio_write
10
+ import audiocraft.models
11
+
12
+
13
  # download models
14
  huggingface_hub.hf_hub_download(
15
  repo_id='Cyan0731/MusiConGen',
16
  filename='compression_state_dict.bin',
17
+ local_dir='./ckpt/musicongen'
18
  )
19
 
20
  huggingface_hub.hf_hub_download(
21
  repo_id='Cyan0731/MusiConGen',
22
  filename='state_dict.bin',
23
+ local_dir='./ckpt/musicongen'
24
  )
25
 
26
  def print_directory_contents(path):
 
45
 
46
 
47
  # load your model
48
+ musicgen = audiocraft.models.MusicGen.get_pretrained('./ckpt/musicongen') ### change this path
49
  musicgen.set_generation_params(duration=duration, extend_stride=duration//2, top_k = 250)
50
 
51