SaiKumar1627 commited on
Commit
ce8a34f
·
verified ·
1 Parent(s): 3bb0a69

Update deliverable2.py

Browse files
Files changed (1) hide show
  1. 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
- # If an error occurs, return the error message
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
- "Domain Trust": domain_trust,
107
- "Content Relevance": similarity_score,
108
- "Fact-Check Score": fact_check_score,
109
- "Bias Score": bias_score,
110
- "Final Validity Score": final_score,
111
- "Star Rating": icon,
112
- "Explanation": explanation
 
 
 
 
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
  }