YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

import gradio as gr import textwrap from datetime import datetime

Scenario

SCENARIO = ( "A manager's highest-performing employee is discovered to have a history of workplace misconduct at their " "previous job, a history that was not disclosed during the interview process. The employee is critical to a " "major, ongoing project. Should HR ignore the misconduct to protect the company's immediate project goals and " "reward employee loyalty, or terminate the employee to uphold the company's ethical standards and ensure a fair, " "transparent workplace?" )

DISCLAIMER = ( "⚠️ Disclaimer: This agent provides general HR guidance for educational purposes only and is not legal advice. " "For real decisions, consult your organization's counsel and follow applicable laws and company policy." )

--- Core guidance blocks ---

def guidance_high_level(): return textwrap.dedent("""
High-level guidance: β€’ Do not ignore the information β€” that undermines standards and creates risk. β€’ Do not rush to terminate solely based on past allegations. Verify facts. β€’ Run a fair, documented review aligned with policy and law. β€’ Manage project continuity in parallel to reduce disruption. """)

def guidance_answers(): return { "ignore": "❌ Ignoring credible misconduct is not recommended. It signals favoritism and risk.", "terminate": "βš–οΈ Do not auto-terminate. Verify facts, check policy, and apply standards consistently.", "investigate": "πŸ” Yes, conduct a fair and timely investigation, with employee input.", "project": "πŸ“‚ Protect the project: implement knowledge transfer, backups, and coverage plans.", "ethics": "🌐 Ethics vs results: uphold standards while balancing project continuity. Never sacrifice fairness." }

KEYWORDS = { "ignore": ["ignore", "look the other way"], "terminate": ["terminate", "fire", "dismiss"], "investigate": ["investigate", "review", "verify"], "project": ["project", "deadline", "handoff", "transition"], "ethics": ["ethics", "standards", "fair", "transparent"] }

def route_intent(user_text: str): t = user_text.lower() for intent, keys in KEYWORDS.items(): if any(k in t for k in keys): return intent return "general"

def generate_response(message, history): intent = route_intent(message) answers = guidance_answers()

if message.strip().lower() in ("scenario",):
    return SCENARIO
if message.strip().lower() in ("policy", "overview"):
    return guidance_high_level()

if intent in answers:
    return answers[intent] + "\n\n" + DISCLAIMER
else:
    return f"{DISCLAIMER}\n\nRecommended next step: Begin a fair, fact-based review. Use 'policy' for high-level guidance."

--- Gradio Chat UI ---

with gr.Blocks() as demo: gr.Markdown("## πŸ€– HR Ethics AI Agent") gr.Markdown("Ask me questions about the HR scenario below.\n\n" + SCENARIO)

chatbot = gr.Chatbot()
msg = gr.Textbox(placeholder="Ask HR Agent a question...")
clear = gr.Button("Clear")

def respond(message, chat_history):
    bot_message = generate_response(message, chat_history)
    chat_history.append((message, bot_message))
    return "", chat_history

msg.submit(respond, [msg, chatbot], [msg, chatbot])
clear.click(lambda: None, None, chatbot, queue=False)

demo.launch()

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support