added model url to default params
Browse files- handler.py +5 -1
handler.py
CHANGED
|
@@ -3,7 +3,7 @@ from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
class EndpointHandler:
|
| 6 |
-
def __init__(self, path=""):
|
| 7 |
# load model and processor
|
| 8 |
self.processor = AutoProcessor.from_pretrained(path)
|
| 9 |
self.model = MusicgenForConditionalGeneration.from_pretrained(path, torch_dtype=torch.float16)
|
|
@@ -36,3 +36,7 @@ class EndpointHandler:
|
|
| 36 |
|
| 37 |
return [{"audio": pred, "sr": self.model.config.sampling_rate}]
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
class EndpointHandler:
|
| 6 |
+
def __init__(self, path="pbotsaris/musicgen-small"):
|
| 7 |
# load model and processor
|
| 8 |
self.processor = AutoProcessor.from_pretrained(path)
|
| 9 |
self.model = MusicgenForConditionalGeneration.from_pretrained(path, torch_dtype=torch.float16)
|
|
|
|
| 36 |
|
| 37 |
return [{"audio": pred, "sr": self.model.config.sampling_rate}]
|
| 38 |
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
handler = EndpointHandler()
|