Spaces:
Build error
Build error
File size: 2,482 Bytes
75beed0 b645273 75beed0 37b8011 06b2135 75beed0 b645273 75beed0 b645273 d58ad7b 75beed0 37b8011 be442b8 ca27a6c be442b8 ca27a6c 37b8011 8909ff1 75beed0 f2952c9 9dbdf20 615fe37 9dbdf20 400afbd 75beed0 37b8011 75beed0 37b8011 59bb8c6 37b8011 75beed0 |
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
import streamlit as st
from pdf_to_image import pdf_to_image
from image_to_text import image_to_text
from mirascope_extractor import extractor
import google.generativeai as genai
import pandas as pd
import glob
import os
# from dotenv import load_dotenv
import streamlit as st
from resume_recommender import recommend_resume
# load_dotenv()
global empty_df
openai_api_key = os.environ['OPENAI_API_KEY']
print('This is API key: ', openai_api_key)
genai.configure(api_key=openai_api_key)
st.set_page_config(page_title="CV Recommendor Gen AI")
st.title("Gen AI CV Recommender")
st.write("""
**Find the Best Candidates for Your Job!**
π **What It Does:**
- Analyzes multiple resumes in PDF format.
- Matches them with your job description.
π **How It Works:**
1. Upload resumes π
2. Upload the job description π
3. Get a table of top recommended candidates π
Ready to find the perfect fit? Let's get started!
""")
uploaded_files = st.sidebar.file_uploader("Choose PDF files", accept_multiple_files=True, type="pdf")
job_description = st.sidebar.text_input('Enter Job Description')
if uploaded_files and job_description:
if st.sidebar.button('AI Recommendation'):
image_bytes = pdf_to_image(uploaded_files)
all_texts = []
for image_byte in image_bytes:
print('This is image_byte: ', image_byte)
combine_text = ''
for image in image_byte:
text = image_to_text(image)
combine_text += text
print('This is the text from single PDF: ', combine_text)
all_texts.append(combine_text)
empty_df = pd.DataFrame()
for text in all_texts:
extracted_text = extractor(text)
task_details_dict = extracted_text.dict()
df = pd.DataFrame([task_details_dict])
empty_df = pd.concat([empty_df, df])
recommend_df = recommend_resume(empty_df, job_description)
if 'Unnamed: 0' in recommend_df.columns:
recommend_df = recommend_df.drop('Unnamed: 0', axis=1)
print('Recommendation process done successfully')
st.write(recommend_df)
# csv = empty_df.to_csv(index=False)
# st.download_button(
# label = 'Click to Download CSV',
# data = csv,
# file_name = 'Extracted_data.csv',
# mime='text/csv',
# )
|