SaiKumar1627 commited on
Commit
80eb2ce
·
verified ·
1 Parent(s): 3932a18

Update deliverable2.py

Browse files
Files changed (1) hide show
  1. deliverable2.py +14 -15
deliverable2.py CHANGED
@@ -81,24 +81,24 @@ class URLValidator:
81
  return " ".join(reasons) if reasons else "This source is highly credible and relevant."
82
 
83
  def rate_url_validity(self, user_query: str, url: str):
84
- """ Main function to evaluate the validity of a webpage. """
85
- content = self.fetch_page_content(url)
86
-
87
- # If content fetching failed, return a properly structured response
88
- if "Error" in content:
89
- return {
90
- "raw_score": {
91
- "Domain Trust": 0,
92
- "Content Relevance": 0,
93
- "Fact-Check Score": 0,
94
- "Bias Score": 0,
95
- "Final Validity Score": 0
96
- },
97
  "stars": {
98
  "icon": "❌"
99
  },
100
  "explanation": content # Display the error message
101
- }
102
 
103
  domain_trust = self.get_domain_trust(url, content)
104
  similarity_score = self.compute_similarity_score(user_query, content)
@@ -128,4 +128,3 @@ class URLValidator:
128
  },
129
  "explanation": explanation
130
  }
131
-
 
81
  return " ".join(reasons) if reasons else "This source is highly credible and relevant."
82
 
83
  def rate_url_validity(self, user_query: str, url: str):
84
+ """ Main function to evaluate the validity of a webpage. """
85
+ content = self.fetch_page_content(url)
86
+
87
+ # If content fetching failed, return a properly structured response
88
+ if "Error" in content:
89
+ return {
90
+ "raw_score": {
91
+ "Domain Trust": 0,
92
+ "Content Relevance": 0,
93
+ "Fact-Check Score": 0,
94
+ "Bias Score": 0,
95
+ "Final Validity Score": 0
96
+ },
97
  "stars": {
98
  "icon": "❌"
99
  },
100
  "explanation": content # Display the error message
101
+ }
102
 
103
  domain_trust = self.get_domain_trust(url, content)
104
  similarity_score = self.compute_similarity_score(user_query, content)
 
128
  },
129
  "explanation": explanation
130
  }