Spaces:
Sleeping
Sleeping
spine-crook
commited on
Commit
β’
f9c2757
1
Parent(s):
d0079a1
Update app.py
Browse files
app.py
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from langchain_community.document_loaders import WebBaseLoader
|
3 |
-
|
4 |
-
from chains import Chain
|
5 |
-
# from portfolio import Portfolio
|
6 |
-
from utils import clean_text, extract_text_from_pdf
|
7 |
-
|
8 |
-
|
9 |
-
def create_streamlit_app(llm, clean_text):
|
10 |
-
st.title("π§ Welcome to Cold E-Mail Generator")
|
11 |
-
|
12 |
-
# PDF upload section
|
13 |
-
uploaded_file = st.file_uploader("Upload your resume as PDF", type=["pdf"])
|
14 |
-
pdf_text = extract_text_from_pdf(uploaded_file)
|
15 |
-
# if pdf_text:
|
16 |
-
# st.text_area("Extracted Text", value=pdf_text, height=300)
|
17 |
-
|
18 |
-
|
19 |
-
url_input = st.text_input("Enter the URL of Job Posting:", value="https://
|
20 |
-
submit_button = st.button("Generate E-mail")
|
21 |
-
|
22 |
-
if submit_button:
|
23 |
-
try:
|
24 |
-
loader = WebBaseLoader([url_input])
|
25 |
-
data = clean_text(loader.load().pop().page_content) # cleans any unnecessary garbage text
|
26 |
-
jobs = llm.extract_jobs(data) # create json objects for the job
|
27 |
-
for job in jobs: # this is for if one web page has multiple jobs
|
28 |
-
# skills = job.get('skills', [])
|
29 |
-
summarized_text = llm.summarize_pdf(pdf_text)
|
30 |
-
# st.text_area(summarized_text)
|
31 |
-
email = llm.write_mail(job, summarized_text) # write the email
|
32 |
-
# st.code(email, language='markdown')
|
33 |
-
st.text_area("Email is as follows", value=email, height=500)
|
34 |
-
|
35 |
-
# st.code('hello')
|
36 |
-
except Exception as e:
|
37 |
-
st.error(f"An Error Occurred: {e}")
|
38 |
-
|
39 |
-
|
40 |
-
if __name__ == "__main__":
|
41 |
-
chain = Chain()
|
42 |
-
# portfolio = Portfolio()
|
43 |
-
st.set_page_config(layout="wide", page_title="Cold Email Generator", page_icon="π§")
|
44 |
-
create_streamlit_app(chain, clean_text)
|
45 |
-
|
46 |
-
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from langchain_community.document_loaders import WebBaseLoader
|
3 |
+
|
4 |
+
from chains import Chain
|
5 |
+
# from portfolio import Portfolio
|
6 |
+
from utils import clean_text, extract_text_from_pdf
|
7 |
+
|
8 |
+
|
9 |
+
def create_streamlit_app(llm, clean_text):
|
10 |
+
st.title("π§ Welcome to Cold E-Mail Generator")
|
11 |
+
|
12 |
+
# PDF upload section
|
13 |
+
uploaded_file = st.file_uploader("Upload your resume as PDF", type=["pdf"])
|
14 |
+
pdf_text = extract_text_from_pdf(uploaded_file)
|
15 |
+
# if pdf_text:
|
16 |
+
# st.text_area("Extracted Text", value=pdf_text, height=300)
|
17 |
+
|
18 |
+
|
19 |
+
url_input = st.text_input("Enter the URL of Job Posting:", value="https://jobs.nike.com/job/R-31388")
|
20 |
+
submit_button = st.button("Generate E-mail")
|
21 |
+
|
22 |
+
if submit_button:
|
23 |
+
try:
|
24 |
+
loader = WebBaseLoader([url_input])
|
25 |
+
data = clean_text(loader.load().pop().page_content) # cleans any unnecessary garbage text
|
26 |
+
jobs = llm.extract_jobs(data) # create json objects for the job
|
27 |
+
for job in jobs: # this is for if one web page has multiple jobs
|
28 |
+
# skills = job.get('skills', [])
|
29 |
+
summarized_text = llm.summarize_pdf(pdf_text)
|
30 |
+
# st.text_area(summarized_text)
|
31 |
+
email = llm.write_mail(job, summarized_text) # write the email
|
32 |
+
# st.code(email, language='markdown')
|
33 |
+
st.text_area("Email is as follows", value=email, height=500)
|
34 |
+
|
35 |
+
# st.code('hello')
|
36 |
+
except Exception as e:
|
37 |
+
st.error(f"An Error Occurred: {e}")
|
38 |
+
|
39 |
+
|
40 |
+
if __name__ == "__main__":
|
41 |
+
chain = Chain()
|
42 |
+
# portfolio = Portfolio()
|
43 |
+
st.set_page_config(layout="wide", page_title="Cold Email Generator", page_icon="π§")
|
44 |
+
create_streamlit_app(chain, clean_text)
|
45 |
+
|
46 |
+
|