Deploy complete premium UI application
Browse files- app.py +17 -2
- static/assets/js/premium-app.js +1 -1
app.py
CHANGED
|
@@ -111,13 +111,28 @@ def upload_resume():
|
|
| 111 |
if not text.strip():
|
| 112 |
return jsonify({'error': 'Cannot extract text from PDF'}), 400
|
| 113 |
|
| 114 |
-
prompt = f'''Analyze resume
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
resp = generate_content_with_groq(prompt)
|
| 118 |
if resp:
|
| 119 |
profile = json.loads(resp)
|
| 120 |
if not isinstance(profile.get('key_skills'), list): profile['key_skills'] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
session['candidate_profile'] = profile
|
| 122 |
return jsonify({'message': 'Success', 'candidate_profile': profile, 'session_id': session_id}), 200
|
| 123 |
return jsonify({'error': 'AI failed'}), 500
|
|
|
|
| 111 |
if not text.strip():
|
| 112 |
return jsonify({'error': 'Cannot extract text from PDF'}), 400
|
| 113 |
|
| 114 |
+
prompt = f'''Analyze this resume and extract information. Return JSON with these exact fields:
|
| 115 |
+
- name: candidate's full name (string)
|
| 116 |
+
- email: email address (string)
|
| 117 |
+
- experience: work experience summary as a simple string like "5 years in software development" or "2 roles (3 months, 2 months)"
|
| 118 |
+
- key_skills: array of skill strings like ["Python", "JavaScript", "React"]
|
| 119 |
+
- inferred_position: best matching job title (string)
|
| 120 |
+
|
| 121 |
+
Return ONLY valid JSON: {{"name":"","email":"","experience":"","key_skills":[],"inferred_position":""}}
|
| 122 |
+
|
| 123 |
+
Resume text:
|
| 124 |
+
{text[:8000]}'''
|
| 125 |
|
| 126 |
resp = generate_content_with_groq(prompt)
|
| 127 |
if resp:
|
| 128 |
profile = json.loads(resp)
|
| 129 |
if not isinstance(profile.get('key_skills'), list): profile['key_skills'] = []
|
| 130 |
+
# Ensure experience is a string
|
| 131 |
+
if isinstance(profile.get('experience'), dict):
|
| 132 |
+
exp = profile['experience']
|
| 133 |
+
profile['experience'] = f"{exp.get('years', '')} years" if 'years' in exp else str(exp)
|
| 134 |
+
elif isinstance(profile.get('experience'), list):
|
| 135 |
+
profile['experience'] = ', '.join(str(e) for e in profile['experience'])
|
| 136 |
session['candidate_profile'] = profile
|
| 137 |
return jsonify({'message': 'Success', 'candidate_profile': profile, 'session_id': session_id}), 200
|
| 138 |
return jsonify({'error': 'AI failed'}), 500
|
static/assets/js/premium-app.js
CHANGED
|
@@ -132,7 +132,7 @@ function showInterviewSetup(profile) {
|
|
| 132 |
</div>
|
| 133 |
<div class="profile-item">
|
| 134 |
<span class="profile-label">Experience:</span>
|
| 135 |
-
<span class="profile-value">${profile.experience || 'N/A'}</span>
|
| 136 |
</div>
|
| 137 |
<div class="profile-item">
|
| 138 |
<span class="profile-label">Skills:</span>
|
|
|
|
| 132 |
</div>
|
| 133 |
<div class="profile-item">
|
| 134 |
<span class="profile-label">Experience:</span>
|
| 135 |
+
<span class="profile-value">${typeof profile.experience === 'object' ? JSON.stringify(profile.experience) : (profile.experience || 'N/A')}</span>
|
| 136 |
</div>
|
| 137 |
<div class="profile-item">
|
| 138 |
<span class="profile-label">Skills:</span>
|