Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from huggingface_hub import InferenceClient
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
client = InferenceClient(
|
| 6 |
-
model="
|
| 7 |
-
token=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.
|
|
@@ -37,37 +37,36 @@ You must output your response in this exact structure:
|
|
| 37 |
## π‘ One Honest Verdict
|
| 38 |
[One sentence: should they apply now, in 3 months, or pivot entirely?]
|
| 39 |
|
| 40 |
-
Be specific. Name actual technologies. Do not be vague.
|
| 41 |
|
| 42 |
|
| 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"""
|
| 48 |
---
|
| 49 |
{resume_text}
|
| 50 |
---
|
| 51 |
-
|
| 52 |
-
Here is the job description they want to apply to:
|
| 53 |
---
|
| 54 |
{job_description}
|
| 55 |
---
|
| 56 |
-
|
| 57 |
-
Tell them exactly why they will be rejected and what to do about it."""
|
| 58 |
|
| 59 |
try:
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
],
|
| 65 |
-
max_tokens=1024,
|
| 66 |
temperature=0.7,
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
| 69 |
except Exception as e:
|
| 70 |
-
return f"β Error: {str(e)}
|
|
|
|
| 71 |
|
| 72 |
EXAMPLE_RESUME = """Name: Priya Sharma
|
| 73 |
Education: M.S. Computer Science, 2024
|
|
@@ -95,54 +94,55 @@ Requirements:
|
|
| 95 |
- Experience with data pipelines: Spark, Kafka, Airflow
|
| 96 |
- Nice to have: ONNX optimization, TensorRT, model quantization"""
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
gr.HTML("""
|
| 108 |
-
<div
|
| 109 |
<h1>π Rejected Before Applying</h1>
|
| 110 |
-
<p
|
| 111 |
-
|
| 112 |
-
</p>
|
| 113 |
-
<p style='color:#888; font-size:0.9em;'>Powered by Qwen2.5-3B β’ No data stored β’ Brutal honesty guaranteed</p>
|
| 114 |
</div>
|
| 115 |
""")
|
| 116 |
|
| 117 |
-
with gr.Row():
|
| 118 |
with gr.Column():
|
| 119 |
resume_input = gr.Textbox(
|
| 120 |
-
label="π Your Resume
|
| 121 |
placeholder="Paste your resume here β skills, experience, education, projects...",
|
| 122 |
-
lines=
|
| 123 |
value=EXAMPLE_RESUME
|
| 124 |
)
|
| 125 |
with gr.Column():
|
| 126 |
jd_input = gr.Textbox(
|
| 127 |
-
label="πΌ Job Description
|
| 128 |
-
placeholder="Paste the job description here...",
|
| 129 |
-
lines=
|
| 130 |
value=EXAMPLE_JD
|
| 131 |
)
|
| 132 |
|
| 133 |
-
analyze_btn = gr.Button("π
|
|
|
|
|
|
|
| 134 |
|
| 135 |
-
output = gr.Markdown(label="Your Rejection Report")
|
| 136 |
|
| 137 |
-
analyze_btn.click(
|
| 138 |
-
fn=analyze,
|
| 139 |
-
inputs=[resume_input, jd_input],
|
| 140 |
-
outputs=output
|
| 141 |
-
)
|
| 142 |
|
| 143 |
gr.HTML("""
|
| 144 |
-
<div style='text-align:center; margin-top:
|
| 145 |
-
Built for the π€ Build Small Hackathon β’ Small model, real talk
|
| 146 |
</div>
|
| 147 |
""")
|
| 148 |
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import os
|
| 3 |
+
from huggingface_hub import InferenceClient
|
| 4 |
|
| 5 |
client = InferenceClient(
|
| 6 |
+
model="HuggingFaceH4/zephyr-7b-beta",
|
| 7 |
+
token=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.
|
|
|
|
| 37 |
## π‘ One Honest Verdict
|
| 38 |
[One sentence: should they apply now, in 3 months, or pivot entirely?]
|
| 39 |
|
| 40 |
+
Be specific. Name actual technologies. Do not be vague."""
|
| 41 |
|
| 42 |
|
| 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 |
+
result = ""
|
| 59 |
+
for token in client.text_generation(
|
| 60 |
+
prompt=f"<|system|>\n{SYSTEM_PROMPT}</s>\n<|user|>\n{user_message}</s>\n<|assistant|>\n",
|
| 61 |
+
max_new_tokens=1024,
|
|
|
|
|
|
|
| 62 |
temperature=0.7,
|
| 63 |
+
stream=True,
|
| 64 |
+
):
|
| 65 |
+
result += token
|
| 66 |
+
return result
|
| 67 |
except Exception as e:
|
| 68 |
+
return f"β Error: {str(e)}"
|
| 69 |
+
|
| 70 |
|
| 71 |
EXAMPLE_RESUME = """Name: Priya Sharma
|
| 72 |
Education: M.S. Computer Science, 2024
|
|
|
|
| 94 |
- Experience with data pipelines: Spark, Kafka, Airflow
|
| 95 |
- Nice to have: ONNX optimization, TensorRT, model quantization"""
|
| 96 |
|
| 97 |
+
css = """
|
| 98 |
+
body { background: #0f0f1a !important; }
|
| 99 |
+
.gradio-container { max-width: 1100px !important; margin: auto; }
|
| 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; letter-spacing: 0.5px; }
|
| 104 |
+
.gr-button-primary:hover { transform: scale(1.02); box-shadow: 0 0 20px #ff416c88 !important; }
|
| 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 |
+
|
| 110 |
+
with gr.Blocks(title="Rejected Before Applying", css=css) as demo:
|
| 111 |
gr.HTML("""
|
| 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 Zephyr-7B β’ π No data stored β’ π― Brutal honesty guaranteed</p>
|
|
|
|
|
|
|
| 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 |
|