Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -254,7 +254,13 @@ def chat_fn(user_text, audio_file, settings, chat_history):
|
|
| 254 |
question, nlu_vectorstore=nlu_vectorstore, behavior_options=CONFIG["behavior_tags"],
|
| 255 |
emotion_options=CONFIG["emotion_tags"], topic_options=CONFIG["topic_tags"],
|
| 256 |
context_options=CONFIG["context_tags"], settings=settings)
|
| 257 |
-
final_tags["scenario_tag"] = detected_tags.get("detected_behaviors", [None])[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
final_tags["emotion_tag"] = detected_tags.get("detected_emotion")
|
| 259 |
final_tags["topic_tag"] = detected_tags.get("detected_topic")
|
| 260 |
final_tags["context_tags"] = detected_tags.get("detected_contexts", [])
|
|
@@ -452,7 +458,7 @@ with gr.Blocks(theme=gr.themes.Soft(), css=CSS) as demo:
|
|
| 452 |
with gr.Group():
|
| 453 |
gr.Markdown("## Conversation & Persona Settings")
|
| 454 |
with gr.Row():
|
| 455 |
-
role = gr.Radio(CONFIG["roles"], value="
|
| 456 |
patient_name = gr.Textbox(label="Patient's Name")
|
| 457 |
caregiver_name = gr.Textbox(label="Caregiver's Name")
|
| 458 |
with gr.Row():
|
|
|
|
| 254 |
question, nlu_vectorstore=nlu_vectorstore, behavior_options=CONFIG["behavior_tags"],
|
| 255 |
emotion_options=CONFIG["emotion_tags"], topic_options=CONFIG["topic_tags"],
|
| 256 |
context_options=CONFIG["context_tags"], settings=settings)
|
| 257 |
+
# final_tags["scenario_tag"] = detected_tags.get("detected_behaviors", [None])[0]
|
| 258 |
+
# fix the bug when the case get() returns NULL
|
| 259 |
+
behaviors = detected_tags.get("detected_behaviors")
|
| 260 |
+
if behaviors:
|
| 261 |
+
final_tags["scenario_tag"] = behaviors[0]
|
| 262 |
+
else:
|
| 263 |
+
final_tags["scenario_tag"] = None
|
| 264 |
final_tags["emotion_tag"] = detected_tags.get("detected_emotion")
|
| 265 |
final_tags["topic_tag"] = detected_tags.get("detected_topic")
|
| 266 |
final_tags["context_tags"] = detected_tags.get("detected_contexts", [])
|
|
|
|
| 458 |
with gr.Group():
|
| 459 |
gr.Markdown("## Conversation & Persona Settings")
|
| 460 |
with gr.Row():
|
| 461 |
+
role = gr.Radio(CONFIG["roles"], value="patient", label="Your Role")
|
| 462 |
patient_name = gr.Textbox(label="Patient's Name")
|
| 463 |
caregiver_name = gr.Textbox(label="Caregiver's Name")
|
| 464 |
with gr.Row():
|