Spaces:
Sleeping
Sleeping
Commit
·
ef4285a
1
Parent(s):
bc4bd1d
direct openai api key
Browse files- app.py +17 -17
- write-messages/msgs.txt +60 -0
- write-messages/temp.txt +0 -0
app.py
CHANGED
|
@@ -15,24 +15,25 @@ dotenv.load_dotenv()
|
|
| 15 |
# Constants
|
| 16 |
DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates", "Arbab - Resume.tex")
|
| 17 |
OUTPUT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "outputs")
|
| 18 |
-
# Allowed passcodes
|
| 19 |
-
ALLOWED_PASSCODES = ["jasmine", "jandro", "a"]
|
| 20 |
|
| 21 |
# Ensure output directory exists
|
| 22 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 23 |
|
| 24 |
-
def get_openai_client():
|
| 25 |
-
"""Get the OpenAI client with the API key from environment variables."""
|
|
|
|
|
|
|
|
|
|
| 26 |
api_key = os.environ.get("OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
| 27 |
|
| 28 |
if not api_key:
|
| 29 |
-
raise ValueError("
|
| 30 |
|
| 31 |
return OpenAI(api_key=api_key)
|
| 32 |
|
| 33 |
-
def customize_resume_with_llm(job_description):
|
| 34 |
"""Customize the entire resume based on the job description using OpenAI's LLM."""
|
| 35 |
-
client = get_openai_client()
|
| 36 |
|
| 37 |
# Read the original resume
|
| 38 |
with open(DEFAULT_TEMPLATE_PATH, "r") as f:
|
|
@@ -109,15 +110,14 @@ FORMAT YOUR RESPONSE AS CLEAN LATEX CODE WITH NO EXPLANATIONS OR CODE BLOCKS.
|
|
| 109 |
# Return error message instead of original content
|
| 110 |
raise ValueError(f"Error occurred: {str(e)}")
|
| 111 |
|
| 112 |
-
def create_customized_resume(
|
| 113 |
"""Create a customized resume based on the job description."""
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
return None, "Access denied. Invalid passcode."
|
| 117 |
|
| 118 |
try:
|
| 119 |
# Generate customized resume content
|
| 120 |
-
customized_resume = customize_resume_with_llm(job_description)
|
| 121 |
|
| 122 |
# Save to file
|
| 123 |
output_tex_path = os.path.join(OUTPUT_DIR, "customized_resume.tex")
|
|
@@ -171,9 +171,9 @@ def create_interface():
|
|
| 171 |
|
| 172 |
with gr.Row():
|
| 173 |
with gr.Column():
|
| 174 |
-
|
| 175 |
-
label="
|
| 176 |
-
placeholder="Enter
|
| 177 |
type="password"
|
| 178 |
)
|
| 179 |
|
|
@@ -191,13 +191,13 @@ def create_interface():
|
|
| 191 |
|
| 192 |
customize_btn.click(
|
| 193 |
fn=create_customized_resume,
|
| 194 |
-
inputs=[
|
| 195 |
outputs=[pdf_output, status_text]
|
| 196 |
)
|
| 197 |
|
| 198 |
gr.Markdown("""
|
| 199 |
## How to Use
|
| 200 |
-
1. Enter
|
| 201 |
2. Paste a job description in the text area
|
| 202 |
3. Click "Customize Resume"
|
| 203 |
4. Wait for the AI to tailor your entire resume to match the job requirements
|
|
|
|
| 15 |
# Constants
|
| 16 |
DEFAULT_TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates", "Arbab - Resume.tex")
|
| 17 |
OUTPUT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "outputs")
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Ensure output directory exists
|
| 20 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 21 |
|
| 22 |
+
def get_openai_client(api_key=None):
|
| 23 |
+
"""Get the OpenAI client with the provided API key or from environment variables."""
|
| 24 |
+
if api_key:
|
| 25 |
+
return OpenAI(api_key=api_key)
|
| 26 |
+
|
| 27 |
api_key = os.environ.get("OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
| 28 |
|
| 29 |
if not api_key:
|
| 30 |
+
raise ValueError("No OpenAI API key provided")
|
| 31 |
|
| 32 |
return OpenAI(api_key=api_key)
|
| 33 |
|
| 34 |
+
def customize_resume_with_llm(job_description, api_key=None):
|
| 35 |
"""Customize the entire resume based on the job description using OpenAI's LLM."""
|
| 36 |
+
client = get_openai_client(api_key)
|
| 37 |
|
| 38 |
# Read the original resume
|
| 39 |
with open(DEFAULT_TEMPLATE_PATH, "r") as f:
|
|
|
|
| 110 |
# Return error message instead of original content
|
| 111 |
raise ValueError(f"Error occurred: {str(e)}")
|
| 112 |
|
| 113 |
+
def create_customized_resume(api_key, job_description):
|
| 114 |
"""Create a customized resume based on the job description."""
|
| 115 |
+
if not api_key.strip():
|
| 116 |
+
return None, "Please provide an OpenAI API key"
|
|
|
|
| 117 |
|
| 118 |
try:
|
| 119 |
# Generate customized resume content
|
| 120 |
+
customized_resume = customize_resume_with_llm(job_description, api_key)
|
| 121 |
|
| 122 |
# Save to file
|
| 123 |
output_tex_path = os.path.join(OUTPUT_DIR, "customized_resume.tex")
|
|
|
|
| 171 |
|
| 172 |
with gr.Row():
|
| 173 |
with gr.Column():
|
| 174 |
+
api_key = gr.Textbox(
|
| 175 |
+
label="OpenAI API Key",
|
| 176 |
+
placeholder="Enter your OpenAI API key",
|
| 177 |
type="password"
|
| 178 |
)
|
| 179 |
|
|
|
|
| 191 |
|
| 192 |
customize_btn.click(
|
| 193 |
fn=create_customized_resume,
|
| 194 |
+
inputs=[api_key, job_description],
|
| 195 |
outputs=[pdf_output, status_text]
|
| 196 |
)
|
| 197 |
|
| 198 |
gr.Markdown("""
|
| 199 |
## How to Use
|
| 200 |
+
1. Enter your OpenAI API key
|
| 201 |
2. Paste a job description in the text area
|
| 202 |
3. Click "Customize Resume"
|
| 203 |
4. Wait for the AI to tailor your entire resume to match the job requirements
|
write-messages/msgs.txt
CHANGED
|
@@ -150,3 +150,63 @@ I've attached my resume - I'd be grateful if you could put in a good word for me
|
|
| 150 |
|
| 151 |
Best regards,
|
| 152 |
Arbab
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
Best regards,
|
| 152 |
Arbab
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
Here's the general message that seem to work better
|
| 156 |
+
|
| 157 |
+
Hi, nice to meet you! I'm Arbab, a PhD graduating in two months and currently at Intel (in CA) working on multimodal LLMs, evaluation, fine-tuning. I've published at WACV and NeurIPS, and I'm exploring full-time roles. I'd be happy to share my CV after connecting—thanks!
|
| 158 |
+
https://arbab.dev/
|
| 159 |
+
:)
|
| 160 |
+
|
| 161 |
+
and here's the message from someon i saw on linkedin:
|
| 162 |
+
I am an MSCS student at UMass. I have extensive experience in ML research, having published in venues like WACV, with one paper on LLMs submitted to CML. Our recent work achieves 1 bit KV-Cache quantization which allows running Llama-3.1-8B upto 500k tokens on a single RTX 4090. I would love to connect with you and discuss this opportunity further!
|
| 163 |
+
|
| 164 |
+
I can
|
| 165 |
+
|
| 166 |
+
Lesson learned: providing website in initial messages work better than attaching resume.
|
| 167 |
+
|
| 168 |
+
updated message:
|
| 169 |
+
Hi, nice to meet you! I'm Arbab, graduating PhD in ML, interning @ Intel (California) on LLMs/CV (Architected VLM system automating $6.5M manual testing effort). Multiple internships, IEEE/ACM'23 Distinguished Paper award, WACV/NeurIPS pubs. Seeking full-time AI/ML roles.
|
| 170 |
+
https://arbab.dev/
|
| 171 |
+
:)
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
#---------
|
| 175 |
+
prommpt
|
| 176 |
+
Better Prompt Structure:
|
| 177 |
+
|
| 178 |
+
"Please help me research Muhammad Arbab Arshad to craft a genuine LinkedIn connection message. Specifically:
|
| 179 |
+
|
| 180 |
+
1. First, find their core focus area and unique intersections:
|
| 181 |
+
- What unique combinations of fields do they work in?
|
| 182 |
+
- What problems are they trying to solve?
|
| 183 |
+
- What makes their work stand out?
|
| 184 |
+
|
| 185 |
+
2. Look for personal motivations and impact:
|
| 186 |
+
- Why did they choose this specific field?
|
| 187 |
+
- What real-world impact are they trying to make?
|
| 188 |
+
- What problems are they passionate about solving?
|
| 189 |
+
|
| 190 |
+
3. Find recent concrete work:
|
| 191 |
+
- Latest research papers or projects
|
| 192 |
+
- But focus on understanding the 'why' behind the work
|
| 193 |
+
- Look for patterns in their research interests
|
| 194 |
+
|
| 195 |
+
4. Craft a message that:
|
| 196 |
+
- Shows understanding of their unique perspective/approach
|
| 197 |
+
- Connects with the purpose of their work, not just the technical details
|
| 198 |
+
- Opens up conversation about their journey and motivations
|
| 199 |
+
5. For linkedin link , do not use MCP tool firecrawl but use internet web feature of builtin cursor. But for any other search you can use firecrawl. actually firecrawl does not support linkedin.
|
| 200 |
+
|
| 201 |
+
Please use firecrawl_search and other tools to dig deeper than surface-level achievements. Focus on finding what makes their work personally meaningful to them."
|
| 202 |
+
|
| 203 |
+
To rule out other people, i am actually talking about someone with this linkedin: https://www.linkedin.com/in/arbab-arshad/
|
| 204 |
+
|
| 205 |
+
dong give me info about someone wrong
|
| 206 |
+
make 5 mcp calls
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
Remember you have ot focus just one thing after knowing everything and see what is interesting thing to point out. The trick is to focus on depth and not on breath of things.
|
| 210 |
+
|
| 211 |
+
say in very organic and natural language,
|
| 212 |
+
Hi, I was going through your work and saw you. .... [won this prize] or [recnetly published this] or [work at something unique] or [so on] . congratulations / best of luck / so on.
|
write-messages/temp.txt
ADDED
|
File without changes
|