Ahmed007 commited on
Commit
8f2a0d5
·
verified ·
1 Parent(s): 4f608eb

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -16
main.py CHANGED
@@ -1,30 +1,31 @@
1
  from flask import Flask, request, jsonify
2
- # from langchain.llms import LlamaCpp
3
  from langchain_community.llms import LlamaCpp
4
  from langchain.callbacks.manager import CallbackManager
5
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
6
  from langchain.prompts import PromptTemplate
7
  from langchain.schema.output_parser import StrOutputParser
8
 
 
 
9
  app = Flask(__name__)
10
 
11
- @app.route('/', methods=['POST'])
12
- def get_skills():
13
- n_gpu_layers = 0
14
- n_batch = 1024
15
 
16
- callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
17
 
18
- llm = LlamaCpp(
19
- model_path="phi-2.Q4_K_M.gguf",
20
- temperature=0.1,
21
- n_gpu_layers=n_gpu_layers,
22
- n_batch=n_batch,
23
- callback_manager=callback_manager,
24
- verbose=True,
25
- n_ctx=2048
26
- )
27
 
 
 
28
  cv_body = request.json.get('cv_body')
29
 
30
  template = """Instruct:
@@ -43,4 +44,3 @@ def get_skills():
43
 
44
  if __name__ == '__main__':
45
  app.run()
46
-
 
1
  from flask import Flask, request, jsonify
 
2
  from langchain_community.llms import LlamaCpp
3
  from langchain.callbacks.manager import CallbackManager
4
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
5
  from langchain.prompts import PromptTemplate
6
  from langchain.schema.output_parser import StrOutputParser
7
 
8
+ # from langchain.llms import LlamaCpp
9
+
10
  app = Flask(__name__)
11
 
12
+ n_gpu_layers = 0
13
+ n_batch = 1024
 
 
14
 
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,
22
+ callback_manager=callback_manager,
23
+ verbose=True,
24
+ n_ctx=2048
25
+ )
26
 
27
+ @app.route('/', methods=['POST'])
28
+ def get_skills():
29
  cv_body = request.json.get('cv_body')
30
 
31
  template = """Instruct:
 
44
 
45
  if __name__ == '__main__':
46
  app.run()