yashphalle commited on
Commit
1323518
·
verified ·
1 Parent(s): edf82fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -61,15 +61,15 @@ def evaluate_response(response: str) -> dict:
61
  """
62
  # We'll do a very simplistic approach:
63
  # Relevance: presence of 'remote work' or synonyms + mention of 'software engineers'
64
- relevance = 5 if ("remote work" in response.lower() and "software engineer" in response.lower()) else 3
65
 
66
  # Depth: check if the text is > 100 words or includes multiple paragraphs
67
  word_count = len(response.split())
68
- depth = 5 if word_count > 150 else (4 if word_count > 80 else 3)
69
 
70
  # Clarity: check if there's a mention of 'introduction'/'conclusion' or if it has multiple paragraphs
71
  paragraphs = response.strip().split("\n\n")
72
- clarity = 5 if len(paragraphs) >= 2 else 3
73
 
74
  # References: look for something like 'reference', 'source', 'citation', or an URL
75
  if re.search(r"reference|source|citation|http", response, re.IGNORECASE):
@@ -81,7 +81,7 @@ def evaluate_response(response: str) -> dict:
81
  # We'll penalize if the text is too short or if it's obviously incomplete
82
  if "..." in response[-10:]:
83
  # If it ends with ... maybe it's incomplete
84
- overall = 3
85
  else:
86
  overall = 5 if (relevance >= 4 and depth >= 4 and references >= 4) else 4
87
 
 
61
  """
62
  # We'll do a very simplistic approach:
63
  # Relevance: presence of 'remote work' or synonyms + mention of 'software engineers'
64
+ relevance = 5 if ("remote work" in response.lower() and "software engineer" in response.lower()) else 0
65
 
66
  # Depth: check if the text is > 100 words or includes multiple paragraphs
67
  word_count = len(response.split())
68
+ depth = 5 if word_count > 150 else (4 if word_count > 80 else 0)
69
 
70
  # Clarity: check if there's a mention of 'introduction'/'conclusion' or if it has multiple paragraphs
71
  paragraphs = response.strip().split("\n\n")
72
+ clarity = 5 if len(paragraphs) >= 2 else 0
73
 
74
  # References: look for something like 'reference', 'source', 'citation', or an URL
75
  if re.search(r"reference|source|citation|http", response, re.IGNORECASE):
 
81
  # We'll penalize if the text is too short or if it's obviously incomplete
82
  if "..." in response[-10:]:
83
  # If it ends with ... maybe it's incomplete
84
+ overall = 0
85
  else:
86
  overall = 5 if (relevance >= 4 and depth >= 4 and references >= 4) else 4
87