Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
from
|
| 4 |
|
| 5 |
-
client =
|
| 6 |
-
|
| 7 |
-
|
| 8 |
)
|
| 9 |
|
| 10 |
SYSTEM_PROMPT = """You are a brutally honest but helpful senior hiring manager with 15 years of experience.
|
|
@@ -43,27 +43,17 @@ Be specific. Name actual technologies. Do not be vague."""
|
|
| 43 |
def analyze(resume_text, job_description):
|
| 44 |
if not resume_text.strip() or not job_description.strip():
|
| 45 |
return "β οΈ Please paste both your resume and the job description."
|
| 46 |
-
|
| 47 |
-
user_message = f"""Resume:
|
| 48 |
-
---
|
| 49 |
-
{resume_text}
|
| 50 |
-
---
|
| 51 |
-
Job Description:
|
| 52 |
-
---
|
| 53 |
-
{job_description}
|
| 54 |
-
---
|
| 55 |
-
Tell them exactly why they will be rejected and give the full structured report."""
|
| 56 |
-
|
| 57 |
try:
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
temperature=0.7,
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
result += token
|
| 66 |
-
return result
|
| 67 |
except Exception as e:
|
| 68 |
return f"β Error: {str(e)}"
|
| 69 |
|
|
@@ -100,10 +90,8 @@ body { background: #0f0f1a !important; }
|
|
| 100 |
#title-block { text-align: center; padding: 30px 0 10px 0; }
|
| 101 |
#title-block h1 { font-size: 2.8em; font-weight: 900; background: linear-gradient(90deg, #ff6b6b, #ff8e53, #ff6bff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
|
| 102 |
#title-block p { color: #aaa; font-size: 1.05em; }
|
| 103 |
-
.gr-button-primary { background: linear-gradient(90deg, #ff416c, #ff4b2b) !important; border: none !important; font-size: 1.1em !important; padding: 14px !important; border-radius: 10px !important; font-weight: 700 !important;
|
| 104 |
-
.gr-
|
| 105 |
-
.gr-textbox textarea { background: #1a1a2e !important; color: #e0e0e0 !important; border: 1px solid #333 !important; border-radius: 10px !important; font-size: 0.92em !important; }
|
| 106 |
-
.gr-markdown { background: #1a1a2e !important; border-radius: 12px !important; padding: 20px !important; border: 1px solid #2a2a4a !important; color: #e0e0e0 !important; }
|
| 107 |
label { color: #ccc !important; font-weight: 600 !important; }
|
| 108 |
"""
|
| 109 |
|
|
@@ -112,38 +100,22 @@ with gr.Blocks(title="Rejected Before Applying", css=css) as demo:
|
|
| 112 |
<div id='title-block'>
|
| 113 |
<h1>π Rejected Before Applying</h1>
|
| 114 |
<p>Find out <b>exactly why</b> your resume won't make it β before you waste the application.</p>
|
| 115 |
-
<p style='color:#666; font-size:0.85em;'>β‘ Powered by
|
| 116 |
</div>
|
| 117 |
""")
|
| 118 |
|
| 119 |
with gr.Row(equal_height=True):
|
| 120 |
with gr.Column():
|
| 121 |
-
resume_input = gr.Textbox(
|
| 122 |
-
label="π Your Resume",
|
| 123 |
-
placeholder="Paste your resume here β skills, experience, education, projects...",
|
| 124 |
-
lines=16,
|
| 125 |
-
value=EXAMPLE_RESUME
|
| 126 |
-
)
|
| 127 |
with gr.Column():
|
| 128 |
-
jd_input = gr.Textbox(
|
| 129 |
-
label="πΌ Job Description",
|
| 130 |
-
placeholder="Paste the full job description here...",
|
| 131 |
-
lines=16,
|
| 132 |
-
value=EXAMPLE_JD
|
| 133 |
-
)
|
| 134 |
|
| 135 |
analyze_btn = gr.Button("π Analyse My Rejection", variant="primary", size="lg")
|
| 136 |
-
|
| 137 |
gr.HTML("<div style='margin:10px 0 6px 0; color:#888; font-size:0.85em; text-align:center;'>β³ Analysis takes ~15 seconds β hang tight</div>")
|
| 138 |
-
|
| 139 |
-
output = gr.Markdown(label="π Your Rejection Report", value="*Your rejection report will appear here...*")
|
| 140 |
|
| 141 |
analyze_btn.click(fn=analyze, inputs=[resume_input, jd_input], outputs=output)
|
| 142 |
|
| 143 |
-
gr.HTML(""
|
| 144 |
-
<div style='text-align:center; margin-top:24px; color:#555; font-size:0.82em;'>
|
| 145 |
-
Built for the π€ <b>Build Small Hackathon</b> β’ Small model, real talk
|
| 146 |
-
</div>
|
| 147 |
-
""")
|
| 148 |
|
| 149 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
+
from openai import OpenAI
|
| 4 |
|
| 5 |
+
client = OpenAI(
|
| 6 |
+
base_url="https://router.huggingface.co/novita/v1",
|
| 7 |
+
api_key=os.environ.get("Rejected_tk"),
|
| 8 |
)
|
| 9 |
|
| 10 |
SYSTEM_PROMPT = """You are a brutally honest but helpful senior hiring manager with 15 years of experience.
|
|
|
|
| 43 |
def analyze(resume_text, job_description):
|
| 44 |
if not resume_text.strip() or not job_description.strip():
|
| 45 |
return "β οΈ Please paste both your resume and the job description."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
try:
|
| 47 |
+
response = client.chat.completions.create(
|
| 48 |
+
model="meta-llama/llama-3.1-8b-instruct",
|
| 49 |
+
messages=[
|
| 50 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
| 51 |
+
{"role": "user", "content": f"Resume:\n{resume_text}\n\nJob Description:\n{job_description}\n\nGive the full rejection report."}
|
| 52 |
+
],
|
| 53 |
+
max_tokens=1024,
|
| 54 |
temperature=0.7,
|
| 55 |
+
)
|
| 56 |
+
return response.choices[0].message.content
|
|
|
|
|
|
|
| 57 |
except Exception as e:
|
| 58 |
return f"β Error: {str(e)}"
|
| 59 |
|
|
|
|
| 90 |
#title-block { text-align: center; padding: 30px 0 10px 0; }
|
| 91 |
#title-block h1 { font-size: 2.8em; font-weight: 900; background: linear-gradient(90deg, #ff6b6b, #ff8e53, #ff6bff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
|
| 92 |
#title-block p { color: #aaa; font-size: 1.05em; }
|
| 93 |
+
.gr-button-primary { background: linear-gradient(90deg, #ff416c, #ff4b2b) !important; border: none !important; font-size: 1.1em !important; padding: 14px !important; border-radius: 10px !important; font-weight: 700 !important; }
|
| 94 |
+
.gr-textbox textarea { background: #1a1a2e !important; color: #e0e0e0 !important; border: 1px solid #333 !important; border-radius: 10px !important; }
|
|
|
|
|
|
|
| 95 |
label { color: #ccc !important; font-weight: 600 !important; }
|
| 96 |
"""
|
| 97 |
|
|
|
|
| 100 |
<div id='title-block'>
|
| 101 |
<h1>π Rejected Before Applying</h1>
|
| 102 |
<p>Find out <b>exactly why</b> your resume won't make it β before you waste the application.</p>
|
| 103 |
+
<p style='color:#666; font-size:0.85em;'>β‘ Powered by Llama-3.1-8B β’ π No data stored β’ π― Brutal honesty guaranteed</p>
|
| 104 |
</div>
|
| 105 |
""")
|
| 106 |
|
| 107 |
with gr.Row(equal_height=True):
|
| 108 |
with gr.Column():
|
| 109 |
+
resume_input = gr.Textbox(label="π Your Resume", placeholder="Paste your resume here...", lines=16, value=EXAMPLE_RESUME)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
with gr.Column():
|
| 111 |
+
jd_input = gr.Textbox(label="πΌ Job Description", placeholder="Paste the full job description here...", lines=16, value=EXAMPLE_JD)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
analyze_btn = gr.Button("π Analyse My Rejection", variant="primary", size="lg")
|
|
|
|
| 114 |
gr.HTML("<div style='margin:10px 0 6px 0; color:#888; font-size:0.85em; text-align:center;'>β³ Analysis takes ~15 seconds β hang tight</div>")
|
| 115 |
+
output = gr.Markdown(value="*Your rejection report will appear here...*")
|
|
|
|
| 116 |
|
| 117 |
analyze_btn.click(fn=analyze, inputs=[resume_input, jd_input], outputs=output)
|
| 118 |
|
| 119 |
+
gr.HTML("<div style='text-align:center; margin-top:24px; color:#555; font-size:0.82em;'>Built for the π€ <b>Build Small Hackathon</b> β’ Small model, real talk</div>")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
demo.launch()
|