Spaces:
Runtime error
Runtime error
Commit
·
cc8caac
1
Parent(s):
77a5d8b
Created the first iteration of app.
Browse files- NLP_pkg/__init__.py +32 -0
- NLP_pkg/__pycache__/__init__.cpython-38.pyc +0 -0
- app.py +14 -2
NLP_pkg/__init__.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
import os
|
| 3 |
+
openai.api_key = os.environ['OPENAI_API_KEY']
|
| 4 |
+
|
| 5 |
+
def request_api(prompt):
|
| 6 |
+
response = openai.Completion.create(
|
| 7 |
+
model="text-davinci-003",
|
| 8 |
+
prompt=prompt,
|
| 9 |
+
temperature=0.5,
|
| 10 |
+
max_tokens=200
|
| 11 |
+
)
|
| 12 |
+
res = response.to_dict_recursive()['choices'][0]['text']
|
| 13 |
+
return res
|
| 14 |
+
|
| 15 |
+
def create_prompt(resume, jd):
|
| 16 |
+
prompt = f"""Write a small summary for a Job application for the following
|
| 17 |
+
resume based on Job requirements structuring the summary based on skills,
|
| 18 |
+
tools excluding repititive technologies.
|
| 19 |
+
Job Requirements:
|
| 20 |
+
"{jd}
|
| 21 |
+
"
|
| 22 |
+
Resume Text:
|
| 23 |
+
"{resume}
|
| 24 |
+
"
|
| 25 |
+
Start the response with
|
| 26 |
+
"Hi, I am a ..."
|
| 27 |
+
"""
|
| 28 |
+
return prompt
|
| 29 |
+
|
| 30 |
+
def generate_summary(resume, jd):
|
| 31 |
+
return request_api(create_prompt(resume, jd))
|
| 32 |
+
|
NLP_pkg/__pycache__/__init__.cpython-38.pyc
ADDED
|
Binary file (1.11 kB). View file
|
|
|
app.py
CHANGED
|
@@ -1,4 +1,16 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
x = st.slider('Select a value')
|
| 4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
from NLP_pkg import request_api, generate_summary
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
resume = st.text_area("Paste your resume here")
|
| 8 |
+
jd = st.text_area('Paste the Job Description')
|
| 9 |
+
# company_info = st.text_area('Enter information about the company')
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
if st.button("Go"):
|
| 14 |
+
output_label = generate_summary(resume, jd)
|
| 15 |
+
st.write("", output_label)
|
| 16 |
|
|
|
|
|
|