|
import streamlit as st |
|
from langchain_community.document_loaders import WebBaseLoader |
|
|
|
from chains import Chain |
|
|
|
from utils import clean_text, extract_text_from_pdf |
|
|
|
|
|
def create_streamlit_app(llm, clean_text): |
|
st.title("π§ Welcome to Cold E-Mail Generator") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload your resume as PDF", type=["pdf"]) |
|
pdf_text = extract_text_from_pdf(uploaded_file) |
|
|
|
|
|
|
|
|
|
url_input = st.text_input("Enter the URL of Job Posting:", value="https://careers.myntra.com/job-detail/?id=7431200002") |
|
submit_button = st.button("Generate E-mail") |
|
|
|
if submit_button: |
|
try: |
|
loader = WebBaseLoader([url_input]) |
|
data = clean_text(loader.load().pop().page_content) |
|
jobs = llm.extract_jobs(data) |
|
for job in jobs: |
|
|
|
summarized_text = llm.summarize_pdf(pdf_text) |
|
|
|
email = llm.write_mail(job, summarized_text) |
|
|
|
st.text_area("Email is as follows", value=email, height=500) |
|
|
|
|
|
except Exception as e: |
|
st.error(f"An Error Occurred: {e}") |
|
|
|
|
|
if __name__ == "__main__": |
|
chain = Chain() |
|
|
|
st.set_page_config(layout="wide", page_title="Cold Email Generator", page_icon="π§") |
|
create_streamlit_app(chain, clean_text) |
|
|
|
|
|
|