SCANSKY commited on
Commit
13ffec1
·
verified ·
1 Parent(s): 9c08e94

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +12 -11
handler.py CHANGED
@@ -8,17 +8,17 @@ class EndpointHandler:
8
  """
9
  self.topic_model = BERTopic.load(model_path)
10
 
11
- def preprocess(self, data):
12
- """
13
- Preprocess the incoming request data.
14
- - Extract text input from the request.
15
- """
16
- try:
17
- # Directly work with the incoming data dictionary
18
- text_input = data.get("text", "")
19
- return text_input
20
- except Exception as e:
21
- raise ValueError(f"Error during preprocessing: {str(e)}")
22
 
23
  def inference(self, text_input):
24
  """
@@ -70,3 +70,4 @@ def preprocess(self, data):
70
  return response
71
  except Exception as e:
72
  return [{"error": str(e)}] # Returning error as a list with a dictionary
 
 
8
  """
9
  self.topic_model = BERTopic.load(model_path)
10
 
11
+ def preprocess(self, data):
12
+ """
13
+ Preprocess the incoming request data.
14
+ - Extract text input from the request.
15
+ """
16
+ try:
17
+ # Directly work with the incoming data dictionary
18
+ text_input = data.get("text", "")
19
+ return text_input
20
+ except Exception as e:
21
+ raise ValueError(f"Error during preprocessing: {str(e)}")
22
 
23
  def inference(self, text_input):
24
  """
 
70
  return response
71
  except Exception as e:
72
  return [{"error": str(e)}] # Returning error as a list with a dictionary
73
+