Martín Santillán Cooper commited on
Commit
d33d1ff
1 Parent(s): 2b52fec

Improve log

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. model.py +0 -1
app.py CHANGED
@@ -49,6 +49,7 @@ def on_submit(criteria, context, user_message, assistant_message, state):
49
  }, state['selected_sub_catalog'])
50
  evaluated_component = to_title_case(get_evaluated_component(state['selected_sub_catalog'], state['selected_criteria_name']))
51
  evaluated_component_adjective = get_evaluated_component_adjective(state['selected_sub_catalog'], state['selected_criteria_name'])
 
52
  result_label = generate_text(prompt)['assessment'] # Yes or No
53
  result_str = f"Is the {evaluated_component} message harmful based on the risk definition: {result_label}"
54
  return gr.update(value=result_str)
 
49
  }, state['selected_sub_catalog'])
50
  evaluated_component = to_title_case(get_evaluated_component(state['selected_sub_catalog'], state['selected_criteria_name']))
51
  evaluated_component_adjective = get_evaluated_component_adjective(state['selected_sub_catalog'], state['selected_criteria_name'])
52
+ logger.debug(f"Starting evaluation for subcatelog {state['selected_sub_catalog']} and criteria name {state['selected_criteria_name']}")
53
  result_label = generate_text(prompt)['assessment'] # Yes or No
54
  result_str = f"Is the {evaluated_component} message harmful based on the risk definition: {result_label}"
55
  return gr.update(value=result_str)
model.py CHANGED
@@ -58,7 +58,6 @@ if not mock_model_call:
58
  tokenizer = AutoTokenizer.from_pretrained(model_path)
59
 
60
  def generate_text(prompt):
61
- logger.debug('Starting evaluation...')
62
  logger.debug(f'Prompts content is: \n{prompt["content"]}')
63
  mock_model_call = os.getenv('MOCK_MODEL_CALL') == 'true'
64
  if mock_model_call:
 
58
  tokenizer = AutoTokenizer.from_pretrained(model_path)
59
 
60
  def generate_text(prompt):
 
61
  logger.debug(f'Prompts content is: \n{prompt["content"]}')
62
  mock_model_call = os.getenv('MOCK_MODEL_CALL') == 'true'
63
  if mock_model_call: