Vaibhav Srivastav
commited on
Commit
•
60f5a74
1
Parent(s):
5f6ee1c
up
Browse files- handler.py +0 -11
handler.py
CHANGED
@@ -2,17 +2,6 @@ from typing import Dict, List, Any
|
|
2 |
from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
3 |
import torch
|
4 |
|
5 |
-
processor = AutoProcessor.from_pretrained("facebook/musicgen-small")
|
6 |
-
model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small")
|
7 |
-
|
8 |
-
inputs = processor(
|
9 |
-
text=["80s pop track with bassy drums and synth", "90s rock song with loud guitars and heavy drums"],
|
10 |
-
padding=True,
|
11 |
-
return_tensors="pt",
|
12 |
-
)
|
13 |
-
|
14 |
-
audio_values = model.generate(**inputs, max_new_tokens=256)
|
15 |
-
|
16 |
class EndpointHandler:
|
17 |
def __init__(self, path=""):
|
18 |
# load model and processor from path
|
|
|
2 |
from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class EndpointHandler:
|
6 |
def __init__(self, path=""):
|
7 |
# load model and processor from path
|