-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
43 lines (33 loc) · 1.03 KB
/
server.py
File metadata and controls
43 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from coho import reader_bot,auth,get_summary,get_pdf
from flask import Flask, jsonify,request
import os
app = Flask(__name__)
@app.route('/',methods=['GET','POST'])
def home():
if request.method == "POST":
# try:
data = request.get_json()
link = data['resume']
company=data['companyName']
poc=data['poc']
role=data['role']
get_pdf(link)
cohere_api_key, _, _ = auth()
pages = reader_bot('sample.pdf')
message= get_summary(pages,cohere_api_key,company,poc,role, )
result={
'message':message
}
os.remove('sample.pdf')
return jsonify(result)
# except:
# cohere_api_key, _, _ = auth()
# pages = reader_bot('sample_resume.pdf')
# message= get_summary(pages, cohere_api_key)
# result={
# 'message':message
# }
# return jsonify(result)
else:
return "GET Request not allowed."
app.run(debug=True)