Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from modules.kyc_processor import extract_text_from_id | |
| from modules.profile_matcher import match_profiles | |
| from modules.interview_scheduler import suggest_slots | |
| from modules.onboarding_trainer import generate_quiz | |
| from modules.performance_tracker import analyze_performance | |
| from modules.agent_motivation import personalized_nudge | |
| def run_kyc(image): | |
| return extract_text_from_id(image) | |
| def run_profile_match(resume, job_role): | |
| return match_profiles(resume, job_role) | |
| def run_schedule(availability): | |
| return suggest_slots(eval(availability)) # input as a dict | |
| def run_quiz(topic): | |
| return generate_quiz(topic) | |
| def run_performance(agent_data): | |
| try: | |
| agents = eval(agent_data) | |
| return "\n".join(analyze_performance(agents)) | |
| except: | |
| return "Invalid data format. Use: [{'name': 'A', 'sales': 5}, ...]" | |
| def run_motivation(name, goal): | |
| return personalized_nudge(name, goal) | |
| with gr.Blocks(title="Agent Recruitment & Management Suite") as demo: | |
| with gr.Tab("KYC OCR"): | |
| gr.Markdown("### Upload an ID Document for OCR") | |
| image_input = gr.Image(type="filepath") | |
| ocr_output = gr.Textbox(label="Extracted Text") | |
| gr.Button("Extract").click(run_kyc, inputs=image_input, outputs=ocr_output) | |
| with gr.Tab("Agent Profile Matcher"): | |
| gr.Markdown("### Compare Resume with Job Role") | |
| resume_input = gr.Textbox(label="Resume Text") | |
| job_input = gr.Textbox(label="Job Role Description") | |
| match_output = gr.Textbox(label="Match Result") | |
| gr.Button("Check Match").click(run_profile_match, [resume_input, job_input], match_output) | |
| with gr.Tab("Interview Scheduler"): | |
| gr.Markdown("### Suggest Interview Slots") | |
| schedule_input = gr.Textbox(label="Availability Dict (e.g. {'2025-06-21': ['10AM', '2PM']})") | |
| schedule_output = gr.Textbox(label="Suggested Slots") | |
| gr.Button("Suggest").click(run_schedule, schedule_input, schedule_output) | |
| with gr.Tab("Training Quiz"): | |
| gr.Markdown("### Generate Quiz for a Topic") | |
| topic_input = gr.Textbox(label="Training Topic") | |
| quiz_output = gr.JSON(label="Generated Quiz") | |
| gr.Button("Generate Quiz").click(run_quiz, topic_input, quiz_output) | |
| with gr.Tab("Performance Tracker"): | |
| gr.Markdown("### Enter Agent Sales Data") | |
| performance_input = gr.Textbox(label="Agent List (e.g. [{'name': 'A', 'sales': 3}])") | |
| performance_output = gr.Textbox(label="Alerts") | |
| gr.Button("Analyze").click(run_performance, performance_input, performance_output) | |
| with gr.Tab("Motivational Nudge"): | |
| gr.Markdown("### Send Motivation to Agent") | |
| name_input = gr.Textbox(label="Agent Name") | |
| goal_input = gr.Textbox(label="Goal (e.g. 10 meetings)") | |
| nudge_output = gr.Textbox(label="Generated Nudge") | |
| gr.Button("Motivate").click(run_motivation, [name_input, goal_input], nudge_output) | |
| demo.launch() | |