rwillats commited on
Commit
d933a87
·
verified ·
1 Parent(s): eb544bc

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. hate_speech_demo.py +4 -1
hate_speech_demo.py CHANGED
@@ -520,7 +520,10 @@ def get_contextual_rating(contextual_api, user_input):
520
  elif "caution" in response_text.lower() or "warning" in response_text.lower():
521
  safety_level = "warning"
522
 
523
- return response_text, retrieval_text, safety_level
 
 
 
524
 
525
  # LlamaGuard rating
526
  LLAMA_HARM_CATEGORIES = {
 
520
  elif "caution" in response_text.lower() or "warning" in response_text.lower():
521
  safety_level = "warning"
522
 
523
+ # Format the response text to separate rating, category, and explanation
524
+ formatted_response = format_contextual_rating(response_text)
525
+
526
+ return formatted_response, retrieval_text, safety_level
527
 
528
  # LlamaGuard rating
529
  LLAMA_HARM_CATEGORIES = {