saherPervaiz commited on
Commit
a69a9de
Β·
verified Β·
1 Parent(s): 863e40a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -23
app.py CHANGED
@@ -58,38 +58,43 @@ def match_jd(jd_text):
58
  def clear_data():
59
  global cv_texts, cv_names, cv_vectors, faiss_index
60
  cv_texts, cv_names, cv_vectors, faiss_index = [], [], [], None
61
- return "🧹 All data cleared."
62
 
63
- # 🌈 Interface with color styling
 
 
64
  with gr.Blocks(css="""
65
  .gr-button { background-color: #2563eb; color: white; font-weight: bold; }
66
  .gr-button:hover { background-color: #1d4ed8; }
67
  textarea, input[type='file'] { border: 2px solid #3b82f6 !important; }
68
  .gr-textbox label { color: #111827; font-weight: 600; }
69
- """) as app:
70
-
71
- gr.HTML("<h2 style='color:#2563eb;'>πŸ“„ CV Filter App (Styled)</h2>")
72
- gr.Markdown("Upload CVs, paste a job description, and match using Groq + FAISS.")
73
-
74
- with gr.Row():
75
- cv_upload = gr.File(label="πŸ“€ Upload CVs", file_types=[".pdf", ".docx"], file_count="multiple")
76
- upload_button = gr.Button("πŸ“ Upload & Index")
77
- upload_status = gr.Textbox(label="Upload Status", interactive=False)
78
-
79
- with gr.Row():
80
- jd_input = gr.Textbox(label="πŸ“‹ Job Description", lines=8, placeholder="Paste job description...")
81
- match_button = gr.Button("πŸ” Match CVs")
82
-
83
- match_result = gr.HTML(label="πŸ“Š Result")
84
-
85
- with gr.Row():
86
- clear_button = gr.Button("🧹 Clear All")
87
- clear_output = gr.Textbox(label="Status", interactive=False)
88
-
89
- # Button actions
90
  upload_button.click(upload_cvs, inputs=[cv_upload], outputs=[upload_status])
 
 
 
 
 
 
91
  match_button.click(match_jd, inputs=[jd_input], outputs=[match_result])
 
 
 
 
 
 
92
  clear_button.click(clear_data, inputs=[], outputs=[clear_output])
93
 
 
 
 
 
 
 
94
  if __name__ == "__main__":
95
  app.launch()
 
58
  def clear_data():
59
  global cv_texts, cv_names, cv_vectors, faiss_index
60
  cv_texts, cv_names, cv_vectors, faiss_index = [], [], [], None
61
+ return "🧹 All data cleared. You can now start fresh."
62
 
63
+ # ======================
64
+ # TABBED PROFESSIONAL UI
65
+ # ======================
66
  with gr.Blocks(css="""
67
  .gr-button { background-color: #2563eb; color: white; font-weight: bold; }
68
  .gr-button:hover { background-color: #1d4ed8; }
69
  textarea, input[type='file'] { border: 2px solid #3b82f6 !important; }
70
  .gr-textbox label { color: #111827; font-weight: 600; }
71
+ """) as upload_tab:
72
+ gr.Markdown("## πŸ“€ Upload CVs")
73
+ gr.Markdown("Upload candidate CVs in PDF or DOCX format.")
74
+ cv_upload = gr.File(label="Upload CVs", file_types=[".pdf", ".docx"], file_count="multiple")
75
+ upload_button = gr.Button("πŸ“ Upload & Index CVs")
76
+ upload_status = gr.Textbox(label="Status", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  upload_button.click(upload_cvs, inputs=[cv_upload], outputs=[upload_status])
78
+
79
+ with gr.Blocks() as match_tab:
80
+ gr.Markdown("## πŸ“‹ Match Job Description to CVs")
81
+ jd_input = gr.Textbox(label="Paste Job Description", lines=8, placeholder="e.g. Looking for a Python Data Analyst...")
82
+ match_button = gr.Button("πŸ” Match CVs")
83
+ match_result = gr.HTML()
84
  match_button.click(match_jd, inputs=[jd_input], outputs=[match_result])
85
+
86
+ with gr.Blocks() as reset_tab:
87
+ gr.Markdown("## 🧹 Clear All Data")
88
+ gr.Markdown("Click below to reset the app and upload new CVs.")
89
+ clear_button = gr.Button("Reset App")
90
+ clear_output = gr.Textbox(label="Reset Status", interactive=False)
91
  clear_button.click(clear_data, inputs=[], outputs=[clear_output])
92
 
93
+ # Menu Bar Style Tabs
94
+ app = gr.TabbedInterface(
95
+ interface_list=[upload_tab, match_tab, reset_tab],
96
+ tab_names=["πŸ“€ Upload CVs", "πŸ“‹ Match JD", "🧹 Reset"]
97
+ )
98
+
99
  if __name__ == "__main__":
100
  app.launch()