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 = """

📜 Instructions:

""" COVER_LETTER_INSTRUCTIONS = """

📚 Instructions for Cover Letter Generation:

  1. 👉 First, go to the "Resume Analyzer" tab.
  2. 👌 Upload your resume and enter the job description there.
  3. 🌟 Then, come back to this tab and click "Generate Cover Letter".
""" FOOTER_TEXT = """ """ INTERVIEW_QUESTIONS_INSTRUCTIONS = """

🔧 Instructions for Interview Questions Generation:

📝 Enter the job description in the text box below and click "Generate Interview Questions".

""" COVER_LETTER_DISCLAIMER = """

📢 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.

""" INTERVIEW_QUESTIONS_DISCLAIMER = """

📢 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.

""" TITLE = "

📚 ATS Resume Analyzer 📚

" 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()