Spaces:
Build error
Build error
Update deliverable2.py
Browse files- deliverable2.py +12 -8
deliverable2.py
CHANGED
|
@@ -83,7 +83,7 @@ class URLValidator:
|
|
| 83 |
""" Main function to evaluate the validity of a webpage. """
|
| 84 |
content = self.fetch_page_content(url)
|
| 85 |
|
| 86 |
-
#
|
| 87 |
if "Error" in content:
|
| 88 |
return {"Validation Error": content}
|
| 89 |
|
|
@@ -103,11 +103,15 @@ class URLValidator:
|
|
| 103 |
explanation = self.generate_explanation(domain_trust, similarity_score, fact_check_score, bias_score, final_score)
|
| 104 |
|
| 105 |
return {
|
| 106 |
-
"
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
|
|
|
| 83 |
""" Main function to evaluate the validity of a webpage. """
|
| 84 |
content = self.fetch_page_content(url)
|
| 85 |
|
| 86 |
+
# ✅ Handle errors by returning a proper message
|
| 87 |
if "Error" in content:
|
| 88 |
return {"Validation Error": content}
|
| 89 |
|
|
|
|
| 103 |
explanation = self.generate_explanation(domain_trust, similarity_score, fact_check_score, bias_score, final_score)
|
| 104 |
|
| 105 |
return {
|
| 106 |
+
"raw_score": { # ✅ Ensure "raw_score" always exists
|
| 107 |
+
"Domain Trust": domain_trust,
|
| 108 |
+
"Content Relevance": similarity_score,
|
| 109 |
+
"Fact-Check Score": fact_check_score,
|
| 110 |
+
"Bias Score": bias_score,
|
| 111 |
+
"Final Validity Score": final_score
|
| 112 |
+
},
|
| 113 |
+
"stars": {
|
| 114 |
+
"icon": icon
|
| 115 |
+
},
|
| 116 |
+
"explanation": explanation
|
| 117 |
}
|