zemuwen commited on
Commit
9fd3b68
·
verified ·
1 Parent(s): 5350105

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +9 -6
handler.py CHANGED
@@ -2,15 +2,18 @@ from typing import Dict, List, Any
2
  from transformers import pipeline
3
 
4
  class EndpointHandler():
5
- def __init__(self, path=""):
6
- # 初始化方法,加载模型
7
- self.pipeline = pipeline("question-answering", model=path)
8
 
9
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
10
  # 处理输入数据并返回预测结果
11
  inputs = data.get("inputs", "")
12
- # 使用对话模型生成响应
13
- conversation = self.pipeline(inputs)
 
14
 
15
  # 返回模型的响应
16
- return conversation
 
 
 
2
  from transformers import pipeline
3
 
4
  class EndpointHandler():
5
+ def __init__(self, path="zemuwen/14B_lora_ze"):
6
+ # 初始化方法,加载文本分类模型
7
+ self.pipeline = pipeline("conversational ", model=path)
8
 
9
  def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
10
  # 处理输入数据并返回预测结果
11
  inputs = data.get("inputs", "")
12
+
13
+ # 使用分类模型生成响应
14
+ results = self.pipeline(inputs)
15
 
16
  # 返回模型的响应
17
+ return results
18
+
19
+ print(result)