File size: 6,309 Bytes
74165a3 23e5117 74165a3 6368658 784b241 6368658 784b241 6368658 74165a3 6368658 74165a3 6368658 74165a3 6368658 74165a3 6368658 74165a3 6368658 74165a3 6368658 784b241 6368658 784b241 6368658 784b241 74165a3 6368658 74165a3 6368658 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 4328d39 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 74165a3 784b241 |
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
import gradio as gr
import os
from groq import Groq
from PyPDF2 import PdfReader
from docx import Document
GROQ_API_KEY = os.environ.get("GROQ_API")
client = Groq(api_key=GROQ_API_KEY)
CSS = """
.duplicate-button {
margin: auto !important;
color: white !important;
background: black !important;
border-radius: 100vh !important;
transition: transform 0.3s ease-in-out, background 0.3s ease-in-out;
}
.duplicate-button:hover {
transform: scale(1.1);
background: linear-gradient(135deg, #6e8efb, #a777e3) !important;
box-shadow: 0px 4px 10px rgba(110, 142, 251, 0.6);
}
h3, p, h1 {
text-align: center;
color: white;
transition: color 0.3s ease-in-out;
}
h3:hover, p:hover, h1:hover {
color: #6e8efb;
}
footer {
text-align: center;
padding: 10px;
width: 100%;
background-color: black !important;
z-index: 1000;
position: relative;
margin-top: 10px;
color: white !important;
font-weight: bold;
transition: transform 0.3s ease-in-out;
}
footer:hover {
transform: scale(1.02);
}
.container {
background: rgba(255, 255, 255, 0.1);
border-radius: 15px;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 15px;
transition: transform 0.3s ease-in-out;
}
.container:hover {
transform: scale(1.02);
}
.navbar-toggle {
background: black;
color: white;
padding: 10px;
border-radius: 5px;
cursor: pointer;
text-align: center;
margin-bottom: 10px;
transition: transform 0.3s ease-in-out, background 0.3s ease-in-out;
}
.navbar-toggle:hover {
background: linear-gradient(135deg, #6e8efb, #a777e3);
transform: scale(1.05);
}
"""
RESUME_ANALYZER_INSTRUCTIONS = """
<div class="container">
<p>π <strong>Instructions:</strong></p>
<ul>
<li>π Upload your resume (PDF or DOCX) in the file upload area.</li>
<li>π If you want to analyze your resume against a specific job description, keep the checkbox checked and enter the job description in the text box.</li>
<li>π‘ If you want a general resume analysis without a job description, uncheck the "Analyze with Job Description" box.</li>
<li>π Click "Analyze Resume" to get your results.</li>
</ul>
</div>
"""
COVER_LETTER_INSTRUCTIONS = """
<div class="container">
<p>π <strong>Instructions for Cover Letter Generation:</strong></p>
<ol>
<li>π First, go to the "Resume Analyzer" tab.</li>
<li>π Upload your resume and enter the job description there.</li>
<li>π Then, come back to this tab and click "Generate Cover Letter".</li>
</ol>
</div>
"""
FOOTER_TEXT = """
<footer>
<p>If you enjoyed the functionality of the app, please leave a like!<br>
Check out more on <a href="https://www.linkedin.com/in/chowdam-jagan" target="_blank">LinkedIn</a> |
</footer>"""
INTERVIEW_QUESTIONS_INSTRUCTIONS = """
<div class="container">
<p>π§ <strong>Instructions for Interview Questions Generation:</strong></p>
<p>π Enter the job description in the text box below and click "Generate Interview Questions".</p>
</div>
"""
COVER_LETTER_DISCLAIMER = """
<p style="font-style: italic; color: #cccccc; background-color: #000000; padding: 10px; border-radius: 5px;">
π’ Disclaimer: This cover letter is generated based on the provided job description and resume.
It should be carefully reviewed and tailored to your specific needs and the company's requirements before use.
</p>
"""
INTERVIEW_QUESTIONS_DISCLAIMER = """
<p style="font-style: italic; color: #cccccc; background-color: #000000; padding: 10px; border-radius: 5px;">
π’ Disclaimer: These interview questions are generated based on the provided job description.
They should be reviewed and adjusted to better fit the specific role, company culture, and interview process.
</p>
"""
TITLE = "<h1>π ATS Resume Analyzer π</h1>"
PLACEHOLDER = "π Chat with AI about your resume and job descriptions..."
# Define main UI with glassmorphism and hover effects
with gr.Blocks(css=CSS, theme="Nymbo/Nymbo_Theme") as demo:
gr.HTML(TITLE)
with gr.Tab("Resume Analyzer"):
gr.HTML(RESUME_ANALYZER_INSTRUCTIONS)
with gr.Row():
with gr.Column():
with_job_description = gr.Checkbox(
label="Analyze with Job Description",
value=True,
info="Uncheck this box for a general resume analysis without a specific job description."
)
job_description = gr.Textbox(label="π Job Description", lines=5)
resume_file = gr.File(label="π Upload Resume (PDF or DOCX)")
with gr.Column():
resume_content = gr.Textbox(label="Parsed Resume Content", lines=10)
analyze_btn = gr.Button("Analyze Resume", elem_classes="duplicate-button")
output = gr.Markdown()
with gr.Tab("Content Rephraser"):
text_to_rephrase = gr.Textbox(label="π Text to Rephrase", lines=5)
rephrase_btn = gr.Button("Rephrase", elem_classes="duplicate-button")
rephrased_output = gr.Markdown()
with gr.Tab("Cover Letter Generator"):
gr.HTML(COVER_LETTER_INSTRUCTIONS)
gr.HTML(COVER_LETTER_DISCLAIMER)
generate_cl_btn = gr.Button("Generate Cover Letter", elem_classes="duplicate-button")
cover_letter_output = gr.Markdown()
with gr.Tab("Interview Questions Generator"):
gr.HTML(INTERVIEW_QUESTIONS_INSTRUCTIONS)
gr.HTML(INTERVIEW_QUESTIONS_DISCLAIMER)
interview_job_description = gr.Textbox(label="π Job Description for Interview Questions", lines=5)
generate_iq_btn = gr.Button("Generate Interview Questions", elem_classes="duplicate-button")
interview_questions_output = gr.Markdown()
with gr.Accordion("βοΈ Parameters", open=False):
temperature = gr.Slider(
minimum=0, maximum=1, step=0.1, value=0.5, label="π‘οΈ Temperature",
)
max_tokens = gr.Slider(
minimum=50, maximum=1024, step=1, value=1024, label="π Max tokens",
)
gr.HTML(FOOTER_TEXT)
if __name__ == "__main__":
demo.launch()
|