Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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
|
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
|
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 =
|
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 |
|