saherPervaiz commited on
Commit
646e4f3
Β·
verified Β·
1 Parent(s): b908f19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -21
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 "🧹 Data cleared."
62
-
63
- # Gradio Interfaces
64
- iface = gr.Interface(
65
- fn=match_jd,
66
- inputs=[gr.Textbox(lines=10, label="Paste Job Description")],
67
- outputs="text",
68
- title="CV Matcher with Groq",
69
- description="Upload CVs, enter a Job Description, and get top matches and summary."
70
- )
71
-
72
- upload = gr.Interface(
73
- fn=upload_cvs,
74
- inputs=gr.File(file_types=[".pdf", ".docx"], file_count="multiple"),
75
- outputs="text",
76
- title="Upload CVs"
77
- )
78
-
79
- clear = gr.Interface(fn=clear_data, inputs=[], outputs="text", title="Reset Data")
80
-
81
- app = gr.TabbedInterface([upload, iface, clear], ["Upload CVs", "Match JD", "Clear Data"])
 
 
 
 
 
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()