Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ taskgen_client = Client("tencent/Hunyuan-Large")
|
|
12 |
OUTPUT_DIR = "outputs"
|
13 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
14 |
|
15 |
-
# 拆解 JD
|
16 |
def generate_solutions_from_jd(jd):
|
17 |
message = f"""你是一个岗位分析助手,请根据以下JD内容:\n
|
18 |
1. 首先识别一个可以用来测试岗位候选人核心能力的具体任务;
|
@@ -25,14 +25,12 @@ JD: {jd}
|
|
25 |
response = taskgen_client.predict(message=message, api_name="/chat")
|
26 |
|
27 |
task_match = re.search(r"任务[::](.*)", response)
|
28 |
-
|
29 |
-
solution2 = re.search(r"方案2[::](.*)", response)
|
30 |
-
solution3 = re.search(r"方案3[::](.*)", response)
|
31 |
|
32 |
task = task_match.group(1).strip() if task_match else "任务解析失败"
|
33 |
-
s1 =
|
34 |
-
s2 =
|
35 |
-
s3 =
|
36 |
|
37 |
return task, s1, s2, s3
|
38 |
|
@@ -86,4 +84,5 @@ def build_ui():
|
|
86 |
|
87 |
if __name__ == "__main__":
|
88 |
demo = build_ui()
|
89 |
-
demo.launch()
|
|
|
|
12 |
OUTPUT_DIR = "outputs"
|
13 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
14 |
|
15 |
+
# 拆解 JD 成任务,并生成三个解决方案(增强容错)
|
16 |
def generate_solutions_from_jd(jd):
|
17 |
message = f"""你是一个岗位分析助手,请根据以下JD内容:\n
|
18 |
1. 首先识别一个可以用来测试岗位候选人核心能力的具体任务;
|
|
|
25 |
response = taskgen_client.predict(message=message, api_name="/chat")
|
26 |
|
27 |
task_match = re.search(r"任务[::](.*)", response)
|
28 |
+
solutions = re.findall(r"方案[123][::](.*)", response)
|
|
|
|
|
29 |
|
30 |
task = task_match.group(1).strip() if task_match else "任务解析失败"
|
31 |
+
s1 = solutions[0].strip() if len(solutions) > 0 else "方案1解析失败"
|
32 |
+
s2 = solutions[1].strip() if len(solutions) > 1 else "方案2解析失败"
|
33 |
+
s3 = solutions[2].strip() if len(solutions) > 2 else "方案3解析失败"
|
34 |
|
35 |
return task, s1, s2, s3
|
36 |
|
|
|
84 |
|
85 |
if __name__ == "__main__":
|
86 |
demo = build_ui()
|
87 |
+
demo.launch()
|
88 |
+
|