Safetensors
EarthSpeciesProject
NatureLM
Cheeky Sparrow commited on
Commit
fe72895
·
1 Parent(s): ee23cbb
Files changed (2) hide show
  1. handler.py +6 -0
  2. requirements.txt +4 -1
handler.py CHANGED
@@ -54,6 +54,12 @@ class EndpointHandler():
54
  if not query:
55
  return [{"error": "No query provided"}]
56
 
 
 
 
 
 
 
57
  try:
58
  # Run inference using the pipeline
59
  results = self.pipeline(
 
54
  if not query:
55
  return [{"error": "No query provided"}]
56
 
57
+ # Convert list to numpy array if needed (when sent via JSON)
58
+ if isinstance(audio, list):
59
+ audio = np.array(audio, dtype=np.float32)
60
+ elif not isinstance(audio, np.ndarray):
61
+ return [{"error": f"Audio data must be a list or numpy array, got {type(audio)}"}]
62
+
63
  try:
64
  # Run inference using the pipeline
65
  results = self.pipeline(
requirements.txt CHANGED
@@ -1,2 +1,5 @@
1
  git+https://github.com/earthspecies/beans-zero.git
2
- git+https://github.com/earthspecies/naturelm-audio.git@auth_tok
 
 
 
 
1
  git+https://github.com/earthspecies/beans-zero.git
2
+ git+https://github.com/earthspecies/naturelm-audio.git@auth_tok
3
+ requests>=2.25.0
4
+ soundfile>=0.10.0
5
+ numpy>=1.21.0