Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -15,7 +15,7 @@ n_batch = 1024
|
|
15 |
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
|
16 |
|
17 |
llm = LlamaCpp(
|
18 |
-
model_path="
|
19 |
temperature=0.1,
|
20 |
n_gpu_layers=n_gpu_layers,
|
21 |
n_batch=n_batch,
|
@@ -27,19 +27,15 @@ llm = LlamaCpp(
|
|
27 |
@app.route('/', methods=['POST'])
|
28 |
def get_skills():
|
29 |
cv_body = request.json.get('cv_body')
|
30 |
-
question = "What are his best skills? write in points"
|
31 |
|
32 |
-
template = """
|
33 |
-
|
34 |
-
|
35 |
-
<|assistant|>
|
36 |
-
|
37 |
-
"""
|
38 |
|
39 |
prompt = PromptTemplate(template=template, input_variables=["text"])
|
40 |
chain = prompt | llm | StrOutputParser()
|
41 |
|
42 |
-
ans = chain.invoke({"question":
|
43 |
config={
|
44 |
# "callbacks": [ConsoleCallbackHandler()]
|
45 |
})
|
|
|
15 |
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
|
16 |
|
17 |
llm = LlamaCpp(
|
18 |
+
model_path="phi-2.Q4_K_M.gguf",
|
19 |
temperature=0.1,
|
20 |
n_gpu_layers=n_gpu_layers,
|
21 |
n_batch=n_batch,
|
|
|
27 |
@app.route('/', methods=['POST'])
|
28 |
def get_skills():
|
29 |
cv_body = request.json.get('cv_body')
|
|
|
30 |
|
31 |
+
template = """Instruct:
|
32 |
+
Take a deep breath to deep understand, and don't this cv vc = {cv_body} . to answer this question and instructions </s>
|
33 |
+
\nOutput:"""
|
|
|
|
|
|
|
34 |
|
35 |
prompt = PromptTemplate(template=template, input_variables=["text"])
|
36 |
chain = prompt | llm | StrOutputParser()
|
37 |
|
38 |
+
ans = chain.invoke({"question": "What are his best skills? write in points","cv_body":cv_body},
|
39 |
config={
|
40 |
# "callbacks": [ConsoleCallbackHandler()]
|
41 |
})
|