Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
# app.py
|
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
from text_extractor import extract_text_from_file
|
@@ -58,27 +59,32 @@ 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 "π§Ή
|
62 |
-
|
63 |
-
# Gradio
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
)
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
)
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
if __name__ == "__main__":
|
84 |
app.launch()
|
|
|
1 |
# app.py
|
2 |
+
|
3 |
import os
|
4 |
import gradio as gr
|
5 |
from text_extractor import extract_text_from_file
|
|
|
59 |
def clear_data():
|
60 |
global cv_texts, cv_names, cv_vectors, faiss_index
|
61 |
cv_texts, cv_names, cv_vectors, faiss_index = [], [], [], None
|
62 |
+
return "π§Ή All data cleared. You can now start fresh."
|
63 |
+
|
64 |
+
# π Redesigned Gradio Interface with Blocks
|
65 |
+
with gr.Blocks() as app:
|
66 |
+
gr.Markdown("## π CV Filter App")
|
67 |
+
gr.Markdown("Upload candidate CVs, enter a job description, and let AI find the top matches using Groq + FAISS.")
|
68 |
+
|
69 |
+
with gr.Row():
|
70 |
+
cv_upload = gr.File(label="π€ Upload CVs (PDF/DOCX)", file_types=[".pdf", ".docx"], file_count="multiple")
|
71 |
+
upload_button = gr.Button("π Upload & Index CVs")
|
72 |
+
upload_status = gr.Textbox(label="Upload Status", interactive=False)
|
73 |
+
|
74 |
+
with gr.Row():
|
75 |
+
jd_input = gr.Textbox(label="π Paste Job Description", lines=8, placeholder="Enter the job description here...")
|
76 |
+
match_button = gr.Button("π Match CVs")
|
77 |
+
|
78 |
+
match_result = gr.Textbox(label="π Matching Result & Summary", lines=12, interactive=False)
|
79 |
+
|
80 |
+
with gr.Row():
|
81 |
+
clear_button = gr.Button("π§Ή Clear All")
|
82 |
+
clear_output = gr.Textbox(label="Status", interactive=False)
|
83 |
+
|
84 |
+
# Function bindings
|
85 |
+
upload_button.click(fn=upload_cvs, inputs=[cv_upload], outputs=[upload_status])
|
86 |
+
match_button.click(fn=match_jd, inputs=[jd_input], outputs=[match_result])
|
87 |
+
clear_button.click(fn=clear_data, inputs=[], outputs=[clear_output])
|
88 |
|
89 |
if __name__ == "__main__":
|
90 |
app.launch()
|