ThreatLevelD
commited on
Commit
·
1fdb9ef
1
Parent(s):
7b8b1dc
Various fixes
Browse files- gradio_ui.py +2 -1
- mec_api.py +5 -2
gradio_ui.py
CHANGED
|
@@ -6,7 +6,7 @@ scenario_map = get_demo_scenarios()
|
|
| 6 |
|
| 7 |
# ─── PROCESS SCENARIO FUNCTION ────────────────────────────────────────────────────
|
| 8 |
def process_scenario(selected_label):
|
| 9 |
-
fusion_prompt, final_uesp, empathic_response = run_mec_pipeline(selected_label)
|
| 10 |
|
| 11 |
# Extract values from final_uesp
|
| 12 |
primary_emotion = final_uesp.get('primary_emotion', 'TBD')
|
|
@@ -22,6 +22,7 @@ def process_scenario(selected_label):
|
|
| 22 |
- Primary Emotion: {primary_emotion}
|
| 23 |
- Emotional Arc: {emotion_arc}
|
| 24 |
- Resonance: {resonance}
|
|
|
|
| 25 |
"""
|
| 26 |
|
| 27 |
# Construct the Empathic Response section
|
|
|
|
| 6 |
|
| 7 |
# ─── PROCESS SCENARIO FUNCTION ────────────────────────────────────────────────────
|
| 8 |
def process_scenario(selected_label):
|
| 9 |
+
fusion_prompt, final_uesp, empathic_response, emid = run_mec_pipeline(selected_label)
|
| 10 |
|
| 11 |
# Extract values from final_uesp
|
| 12 |
primary_emotion = final_uesp.get('primary_emotion', 'TBD')
|
|
|
|
| 22 |
- Primary Emotion: {primary_emotion}
|
| 23 |
- Emotional Arc: {emotion_arc}
|
| 24 |
- Resonance: {resonance}
|
| 25 |
+
- Emotion ID (EmID): {emid}
|
| 26 |
"""
|
| 27 |
|
| 28 |
# Construct the Empathic Response section
|
mec_api.py
CHANGED
|
@@ -38,7 +38,7 @@ def run_mec_pipeline(user_input_text: str, force_hei: bool = False):
|
|
| 38 |
3) Routing: ERIS vs. HEI fallback based on confidence or force_hei
|
| 39 |
4) FECController.generate_prompt
|
| 40 |
Returns:
|
| 41 |
-
fusion_prompt (str), final_uesp (dict)
|
| 42 |
"""
|
| 43 |
# 1️⃣ EIL
|
| 44 |
eil_packet = eil.infer_emotion(user_input_text)
|
|
@@ -62,13 +62,16 @@ def run_mec_pipeline(user_input_text: str, force_hei: bool = False):
|
|
| 62 |
strategy_name = response_strategies.get(fam_code, {}).get('strategy', 'Strategy not defined')
|
| 63 |
sample_response = response_strategies.get(fam_code, {}).get('sample_response', 'No response available')
|
| 64 |
|
|
|
|
|
|
|
|
|
|
| 65 |
empathic_response = (
|
| 66 |
f"Response Strategy Code: {rsm_code}\n"
|
| 67 |
f"Response Strategy: {strategy_name}\n\n"
|
| 68 |
f"{sample_response}"
|
| 69 |
)
|
| 70 |
|
| 71 |
-
return fusion_prompt, final_uesp, empathic_response
|
| 72 |
|
| 73 |
def get_demo_scenarios():
|
| 74 |
"""
|
|
|
|
| 38 |
3) Routing: ERIS vs. HEI fallback based on confidence or force_hei
|
| 39 |
4) FECController.generate_prompt
|
| 40 |
Returns:
|
| 41 |
+
fusion_prompt (str), final_uesp (dict), empathic_response (str), EmID (str)
|
| 42 |
"""
|
| 43 |
# 1️⃣ EIL
|
| 44 |
eil_packet = eil.infer_emotion(user_input_text)
|
|
|
|
| 62 |
strategy_name = response_strategies.get(fam_code, {}).get('strategy', 'Strategy not defined')
|
| 63 |
sample_response = response_strategies.get(fam_code, {}).get('sample_response', 'No response available')
|
| 64 |
|
| 65 |
+
# Get Emotion ID (EmID)
|
| 66 |
+
emid = final_uesp.get('emid', 'No EmID available')
|
| 67 |
+
|
| 68 |
empathic_response = (
|
| 69 |
f"Response Strategy Code: {rsm_code}\n"
|
| 70 |
f"Response Strategy: {strategy_name}\n\n"
|
| 71 |
f"{sample_response}"
|
| 72 |
)
|
| 73 |
|
| 74 |
+
return fusion_prompt, final_uesp, empathic_response, emid
|
| 75 |
|
| 76 |
def get_demo_scenarios():
|
| 77 |
"""
|