Turbiling commited on
Commit
f6e276d
Β·
verified Β·
1 Parent(s): 9d247ad

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +340 -0
app.py ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ⚑ Quick Start Guide
2
+
3
+ Get the AI Graduate Job-Matching Platform running in 5 minutes!
4
+
5
+ ## 🎯 Prerequisites
6
+
7
+ - Python 3.8+ installed
8
+ - Groq API key ([Get one here](https://console.groq.com/))
9
+ - 2GB free disk space
10
+ - Internet connection
11
+
12
+ ## πŸš€ Option 1: Automated Setup (Recommended)
13
+
14
+ ### For Linux/Mac:
15
+
16
+ ```bash
17
+ # 1. Clone or download the project
18
+ git clone <repository-url>
19
+ cd ai-job-matcher
20
+
21
+ # 2. Make setup script executable
22
+ chmod +x setup.sh
23
+
24
+ # 3. Run setup
25
+ ./setup.sh
26
+
27
+ # 4. Edit .env file with your API key
28
+ nano .env # or use your favorite editor
29
+
30
+ # 5. Run the application
31
+ python app.py
32
+ ```
33
+
34
+ ### For Windows:
35
+
36
+ ```powershell
37
+ # 1. Clone or download the project
38
+ git clone <repository-url>
39
+ cd ai-job-matcher
40
+
41
+ # 2. Create virtual environment
42
+ python -m venv venv
43
+
44
+ # 3. Activate virtual environment
45
+ .\venv\Scripts\activate
46
+
47
+ # 4. Install dependencies
48
+ pip install -r requirements.txt
49
+
50
+ # 5. Create .env file
51
+ echo GROQ_API_KEY=your_key_here > .env
52
+
53
+ # 6. Run the application
54
+ python app.py
55
+ ```
56
+
57
+ ## πŸ› οΈ Option 2: Manual Setup
58
+
59
+ ### Step 1: Install Dependencies
60
+
61
+ ```bash
62
+ pip install groq==0.11.0 gradio==4.44.0 moviepy==1.0.3
63
+ ```
64
+
65
+ ### Step 2: Set Environment Variable
66
+
67
+ **Linux/Mac:**
68
+ ```bash
69
+ export GROQ_API_KEY="your_groq_api_key_here"
70
+ ```
71
+
72
+ **Windows:**
73
+ ```powershell
74
+ $env:GROQ_API_KEY="your_groq_api_key_here"
75
+ ```
76
+
77
+ ### Step 3: Create File Structure
78
+
79
+ ```
80
+ ai-job-matcher/
81
+ β”œβ”€β”€ app.py
82
+ β”œβ”€β”€ requirements.txt
83
+ β”œβ”€β”€ utils/
84
+ β”‚ β”œβ”€β”€ __init__.py
85
+ β”‚ β”œβ”€β”€ transcription.py
86
+ β”‚ β”œβ”€β”€ analysis.py
87
+ β”‚ └── job_match.py
88
+ └── ui/
89
+ β”œβ”€β”€ __init__.py
90
+ └── layout.py
91
+ ```
92
+
93
+ ### Step 4: Run Application
94
+
95
+ ```bash
96
+ python app.py
97
+ ```
98
+
99
+ ### Step 5: Open Browser
100
+
101
+ Navigate to: `http://localhost:7860`
102
+
103
+ ## 🎬 First Test
104
+
105
+ ### 1. Record a Test Video (1-2 minutes)
106
+
107
+ Sample script:
108
+ ```
109
+ "Hello, my name is [Your Name]. I recently graduated with a degree in [Your Field].
110
+ I have skills in [Skill 1], [Skill 2], and [Skill 3]. I'm passionate about [Interest]
111
+ and looking to start my career in [Industry]. Thank you!"
112
+ ```
113
+
114
+ ### 2. Upload Video
115
+
116
+ - Click the upload box
117
+ - Select your video file
118
+ - Choose language (English or Urdu)
119
+
120
+ ### 3. Generate Report
121
+
122
+ - Click "Generate Job Match Report"
123
+ - Wait 30-60 seconds
124
+ - Review results in different tabs
125
+
126
+ ## πŸ“± Access from Mobile
127
+
128
+ 1. Find your local IP:
129
+ ```bash
130
+ # Linux/Mac
131
+ ifconfig | grep inet
132
+
133
+ # Windows
134
+ ipconfig
135
+ ```
136
+
137
+ 2. Share the app:
138
+ ```python
139
+ # In app.py, change:
140
+ demo.launch(share=True)
141
+ ```
142
+
143
+ 3. Use the generated public URL
144
+
145
+ ## πŸ› Troubleshooting
146
+
147
+ ### "GROQ_API_KEY not found"
148
+
149
+ **Solution:**
150
+ ```bash
151
+ # Check if key is set
152
+ echo $GROQ_API_KEY # Linux/Mac
153
+ echo %GROQ_API_KEY% # Windows
154
+
155
+ # Set it again
156
+ export GROQ_API_KEY="your_key" # Linux/Mac
157
+ set GROQ_API_KEY=your_key # Windows
158
+ ```
159
+
160
+ ### "Module not found"
161
+
162
+ **Solution:**
163
+ ```bash
164
+ # Reinstall requirements
165
+ pip install -r requirements.txt --force-reinstall
166
+ ```
167
+
168
+ ### "Port 7860 already in use"
169
+
170
+ **Solution:**
171
+ ```python
172
+ # In app.py, change port:
173
+ demo.launch(server_port=7861)
174
+ ```
175
+
176
+ ### Video upload fails
177
+
178
+ **Solution:**
179
+ - Check video format (MP4, WebM, MOV)
180
+ - Check file size (< 100MB)
181
+ - Check duration (< 2 minutes)
182
+
183
+ ## ☁️ Deploy to Hugging Face (5 minutes)
184
+
185
+ ### Quick Deploy:
186
+
187
+ 1. **Create Space:**
188
+ - Go to [HF Spaces](https://huggingface.co/spaces)
189
+ - Click "Create new Space"
190
+ - Choose Gradio SDK
191
+
192
+ 2. **Upload Files:**
193
+ ```bash
194
+ git clone https://huggingface.co/spaces/USERNAME/SPACE_NAME
195
+ cd SPACE_NAME
196
+ cp -r /path/to/your/project/* .
197
+ git add .
198
+ git commit -m "Initial commit"
199
+ git push
200
+ ```
201
+
202
+ 3. **Add Secret:**
203
+ - Go to Space Settings
204
+ - Add secret: `GROQ_API_KEY`
205
+
206
+ 4. **Access:**
207
+ - URL: `https://huggingface.co/spaces/USERNAME/SPACE_NAME`
208
+
209
+ ## πŸ“Š What to Expect
210
+
211
+ ### Processing Time:
212
+ - Upload: < 5 seconds
213
+ - Transcription: 10-20 seconds
214
+ - Analysis: 15-25 seconds
215
+ - Total: 30-60 seconds
216
+
217
+ ### Output Quality:
218
+ - Transcription accuracy: > 95%
219
+ - Job matches: 10 recommendations
220
+ - Report length: 2000+ words
221
+
222
+ ## πŸŽ“ Example Use Cases
223
+
224
+ ### Computer Science Graduate:
225
+ ```
226
+ Skills: Python, JavaScript, React
227
+ Expected Jobs: Software Developer, Web Developer, Full-Stack Engineer
228
+ Match Scores: 75-90%
229
+ ```
230
+
231
+ ### Business Graduate:
232
+ ```
233
+ Skills: Marketing, Excel, Communication
234
+ Expected Jobs: Marketing Coordinator, Business Analyst, Sales Associate
235
+ Match Scores: 70-85%
236
+ ```
237
+
238
+ ### Engineering Graduate:
239
+ ```
240
+ Skills: CAD, Project Management, Problem-solving
241
+ Expected Jobs: Project Engineer, Design Engineer, Technical Coordinator
242
+ Match Scores: 72-88%
243
+ ```
244
+
245
+ ## πŸ“š Next Steps
246
+
247
+ 1. **Read Full Documentation:**
248
+ - `README.md` - Complete guide
249
+ - `DEPLOYMENT.md` - Deploy to production
250
+ - `TESTING.md` - Testing strategies
251
+
252
+ 2. **Customize:**
253
+ - Modify UI colors/layout
254
+ - Add your company logo
255
+ - Adjust scoring weights
256
+
257
+ 3. **Extend:**
258
+ - Add PDF generation
259
+ - Integrate with job boards
260
+ - Add authentication
261
+
262
+ ## πŸ’‘ Pro Tips
263
+
264
+ ### Tip 1: Better Videos = Better Results
265
+ - Use good lighting
266
+ - Speak clearly
267
+ - Minimize background noise
268
+ - Stay under 2 minutes
269
+
270
+ ### Tip 2: Test with Various Profiles
271
+ - IT/Tech graduates
272
+ - Business graduates
273
+ - Engineering graduates
274
+ - Different experience levels
275
+
276
+ ### Tip 3: Monitor Performance
277
+ ```python
278
+ import time
279
+
280
+ start = time.time()
281
+ result = process_video(video, language)
282
+ print(f"Processing took {time.time() - start:.2f} seconds")
283
+ ```
284
+
285
+ ### Tip 4: Customize Job Weights
286
+ ```python
287
+ # In utils/job_match.py
288
+ SCORING_WEIGHTS = {
289
+ "technical_skills": 0.35, # Increase technical importance
290
+ "soft_skills": 0.20,
291
+ "communication_clarity": 0.15,
292
+ "personality_fit": 0.10,
293
+ "domain_relevance": 0.20
294
+ }
295
+ ```
296
+
297
+ ## πŸ”₯ Common Commands
298
+
299
+ ```bash
300
+ # Start application
301
+ python app.py
302
+
303
+ # Run tests
304
+ pytest tests/
305
+
306
+ # Check code style
307
+ pylint utils/ ui/
308
+
309
+ # Generate coverage report
310
+ pytest --cov=. --cov-report=html
311
+
312
+ # Update dependencies
313
+ pip install -r requirements.txt --upgrade
314
+
315
+ # Create production build
316
+ pip freeze > requirements.txt
317
+
318
+ # Clean cache
319
+ find . -type d -name "__pycache__" -exec rm -r {} +
320
+ ```
321
+
322
+ ## πŸ“ž Get Help
323
+
324
+ - πŸ“– Documentation: See `README.md`
325
+ - πŸ› Issues: [GitHub Issues](link)
326
+ - πŸ’¬ Discussion: [GitHub Discussions](link)
327
+ - πŸ“§ Email: support@example.com
328
+
329
+ ## βœ… Success Checklist
330
+
331
+ - [ ] Python 3.8+ installed
332
+ - [ ] Dependencies installed
333
+ - [ ] GROQ_API_KEY configured
334
+ - [ ] Application starts without errors
335
+ - [ ] Test video processed successfully
336
+ - [ ] All outputs display correctly
337
+ - [ ] Both languages work
338
+ - [ ] Ready for deployment!
339
+
340
+ ---