Phoenixak99
commited on
Update handler.py
Browse files- handler.py +5 -1
handler.py
CHANGED
@@ -22,6 +22,10 @@ class EndpointHandler:
|
|
22 |
duration = inputs.get("duration", 10)
|
23 |
parameters = data.get("parameters", {})
|
24 |
|
|
|
|
|
|
|
|
|
25 |
# Preprocess the prompt
|
26 |
input_ids = self.processor(
|
27 |
text=[prompt],
|
@@ -48,4 +52,4 @@ class EndpointHandler:
|
|
48 |
"generated_audio": audio_list,
|
49 |
"sample_rate": self.sampling_rate,
|
50 |
}
|
51 |
-
]
|
|
|
22 |
duration = inputs.get("duration", 10)
|
23 |
parameters = data.get("parameters", {})
|
24 |
|
25 |
+
# Validate the prompt
|
26 |
+
if not prompt:
|
27 |
+
return {"error": "No prompt provided."}
|
28 |
+
|
29 |
# Preprocess the prompt
|
30 |
input_ids = self.processor(
|
31 |
text=[prompt],
|
|
|
52 |
"generated_audio": audio_list,
|
53 |
"sample_rate": self.sampling_rate,
|
54 |
}
|
55 |
+
]
|