brocks1234 commited on
Commit
78b2be7
·
verified ·
1 Parent(s): 7f10ec1

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +16 -21
handler.py CHANGED
@@ -65,26 +65,21 @@ class EndpointHandler:
65
  # 4. Return coordinates and their corresponding sensitivity scores
66
  return [{"coord": idx, "score": score} for idx, score in zip(indices, distances)]
67
 
68
- def __call__(self, data):
69
- """
70
- Args:
71
- data (:obj:`dict`):
72
- - "inputs": the DNA sequence
73
- - "method": "embed" (default) or "sensitivity"
74
- """
75
- inputs = data.get("inputs", "")
76
- method = data.get("method", "embed")
77
- logger.info("inputs: ")
78
- logger.info(inputs)
79
- logger.info(method)
80
 
81
- if not inputs:
82
- return {"error": "No input sequence provided"}
83
 
84
- if method == "sensitivity":
85
- # Returns the map of high-leverage coordinates
86
- return self.map_sensitivity(inputs)
87
- else:
88
- # Standard embedding behavior
89
- embedding = self._get_embedding(inputs)
90
- return embedding.cpu().tolist()[0]
 
65
  # 4. Return coordinates and their corresponding sensitivity scores
66
  return [{"coord": idx, "score": score} for idx, score in zip(indices, distances)]
67
 
68
+ def __call__(self, data):
69
+ inputs = data.get("inputs", "")
70
+ method = data.get("method", "embed")
71
+
72
+ # Extract parameters with sensible defaults
73
+ # This allows your LangGraph agent to "tune" the resolution
74
+ window_size = data.get("window_size", 50)
75
+ step = data.get("step", 100)
 
 
 
 
76
 
77
+ if not inputs:
78
+ return {"error": "No input sequence provided"}
79
 
80
+ if method == "sensitivity":
81
+ # Pass the new parameters into the mapper
82
+ return self.map_sensitivity(inputs, window_size=window_size, step=step)
83
+ else:
84
+ embedding = self._get_embedding(inputs)
85
+ return embedding.cpu().tolist()[0]