Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,50 +1,71 @@
|
|
|
|
|
|
1 |
from modules.profile_matcher import match_profiles
|
2 |
from modules.interview_scheduler import suggest_slots
|
3 |
-
from modules.kyc_processor import extract_text_from_id
|
4 |
from modules.onboarding_trainer import generate_quiz
|
5 |
from modules.performance_tracker import analyze_performance
|
6 |
from modules.agent_motivation import personalized_nudge
|
7 |
-
import gradio as gr
|
8 |
|
9 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
try:
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from modules.kyc_processor import extract_text_from_id
|
3 |
from modules.profile_matcher import match_profiles
|
4 |
from modules.interview_scheduler import suggest_slots
|
|
|
5 |
from modules.onboarding_trainer import generate_quiz
|
6 |
from modules.performance_tracker import analyze_performance
|
7 |
from modules.agent_motivation import personalized_nudge
|
|
|
8 |
|
9 |
+
def run_kyc(image):
|
10 |
+
return extract_text_from_id(image)
|
11 |
+
|
12 |
+
def run_profile_match(resume, job_role):
|
13 |
+
return match_profiles(resume, job_role)
|
14 |
+
|
15 |
+
def run_schedule(availability):
|
16 |
+
return suggest_slots(eval(availability)) # input as a dict
|
17 |
+
|
18 |
+
def run_quiz(topic):
|
19 |
+
return generate_quiz(topic)
|
20 |
+
|
21 |
+
def run_performance(agent_data):
|
22 |
try:
|
23 |
+
agents = eval(agent_data)
|
24 |
+
return "\n".join(analyze_performance(agents))
|
25 |
+
except:
|
26 |
+
return "Invalid data format. Use: [{'name': 'A', 'sales': 5}, ...]"
|
27 |
+
|
28 |
+
def run_motivation(name, goal):
|
29 |
+
return personalized_nudge(name, goal)
|
30 |
+
|
31 |
+
with gr.Blocks(title="Agent Recruitment & Management Suite") as demo:
|
32 |
+
|
33 |
+
with gr.Tab("KYC OCR"):
|
34 |
+
gr.Markdown("### Upload an ID Document for OCR")
|
35 |
+
image_input = gr.Image(type="filepath")
|
36 |
+
ocr_output = gr.Textbox(label="Extracted Text")
|
37 |
+
gr.Button("Extract").click(run_kyc, inputs=image_input, outputs=ocr_output)
|
38 |
+
|
39 |
+
with gr.Tab("Agent Profile Matcher"):
|
40 |
+
gr.Markdown("### Compare Resume with Job Role")
|
41 |
+
resume_input = gr.Textbox(label="Resume Text")
|
42 |
+
job_input = gr.Textbox(label="Job Role Description")
|
43 |
+
match_output = gr.Textbox(label="Match Result")
|
44 |
+
gr.Button("Check Match").click(run_profile_match, [resume_input, job_input], match_output)
|
45 |
+
|
46 |
+
with gr.Tab("Interview Scheduler"):
|
47 |
+
gr.Markdown("### Suggest Interview Slots")
|
48 |
+
schedule_input = gr.Textbox(label="Availability Dict (e.g. {'2025-06-21': ['10AM', '2PM']})")
|
49 |
+
schedule_output = gr.Textbox(label="Suggested Slots")
|
50 |
+
gr.Button("Suggest").click(run_schedule, schedule_input, schedule_output)
|
51 |
+
|
52 |
+
with gr.Tab("Training Quiz"):
|
53 |
+
gr.Markdown("### Generate Quiz for a Topic")
|
54 |
+
topic_input = gr.Textbox(label="Training Topic")
|
55 |
+
quiz_output = gr.JSON(label="Generated Quiz")
|
56 |
+
gr.Button("Generate Quiz").click(run_quiz, topic_input, quiz_output)
|
57 |
+
|
58 |
+
with gr.Tab("Performance Tracker"):
|
59 |
+
gr.Markdown("### Enter Agent Sales Data")
|
60 |
+
performance_input = gr.Textbox(label="Agent List (e.g. [{'name': 'A', 'sales': 3}])")
|
61 |
+
performance_output = gr.Textbox(label="Alerts")
|
62 |
+
gr.Button("Analyze").click(run_performance, performance_input, performance_output)
|
63 |
+
|
64 |
+
with gr.Tab("Motivational Nudge"):
|
65 |
+
gr.Markdown("### Send Motivation to Agent")
|
66 |
+
name_input = gr.Textbox(label="Agent Name")
|
67 |
+
goal_input = gr.Textbox(label="Goal (e.g. 10 meetings)")
|
68 |
+
nudge_output = gr.Textbox(label="Generated Nudge")
|
69 |
+
gr.Button("Motivate").click(run_motivation, [name_input, goal_input], nudge_output)
|
70 |
+
|
71 |
+
demo.launch()
|