zemuwen commited on
Commit
91259f4
·
verified ·
1 Parent(s): fe31f10

Delete handler.py

Browse files
Files changed (1) hide show
  1. handler.py +0 -19
handler.py DELETED
@@ -1,19 +0,0 @@
1
- from typing import Dict, List, Any
2
- from transformers import pipeline
3
-
4
- class EndpointHandler():
5
- def __init__(self, path="zemuwen/14B_lora_ze"):
6
- # 初始化方法,加载问答模型
7
- self.pipeline = pipeline("question-answering", model=path)
8
-
9
- def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
10
- # 确保输入数据包含 "question" 和 "context"
11
- question = data.get("question", "")
12
- context = data.get("context", "")
13
-
14
- # 使用问答模型生成响应
15
- results = self.pipeline(question=question, context=context)
16
-
17
- # 返回模型的响应
18
- return results
19
-