Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,20 @@ import torchaudio
|
|
| 4 |
from einops import rearrange
|
| 5 |
from stable_audio_tools import get_pretrained_model
|
| 6 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
sample_rate = model_config["sample_rate"]
|
| 10 |
sample_size = model_config["sample_size"]
|
| 11 |
|
|
|
|
| 4 |
from einops import rearrange
|
| 5 |
from stable_audio_tools import get_pretrained_model
|
| 6 |
from stable_audio_tools.inference.generation import generate_diffusion_cond
|
| 7 |
+
from huggingface_hub import cached_download, hf_hub_url
|
| 8 |
+
from transformers import AutoModelForAudioClassification
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
token = os.get.environ("TOKEN")
|
| 12 |
+
model_name = "stabilityai/stable-audio-open-1.0"
|
| 13 |
+
model_config_url = hf_hub_url(repo_id=model_name, revision="main", filename="model_config.json")
|
| 14 |
+
model_config = cached_download(model_config_url, use_auth_token=token)
|
| 15 |
+
|
| 16 |
+
model = AutoModelForAudioClassification.from_pretrained(
|
| 17 |
+
model_name,
|
| 18 |
+
cache_dir=None,
|
| 19 |
+
use_auth_token=token
|
| 20 |
+
)
|
| 21 |
sample_rate = model_config["sample_rate"]
|
| 22 |
sample_size = model_config["sample_size"]
|
| 23 |
|