Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
|
|
|
|
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
|
70 |
-
|
71 |
-
gr.
|
72 |
-
gr.
|
73 |
-
|
74 |
-
|
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()
|