Spaces:
Sleeping
Sleeping
Update Deliverable2.py
Browse files- Deliverable2.py +14 -0
Deliverable2.py
CHANGED
@@ -8,6 +8,20 @@ import random
|
|
8 |
# Instantiate the validator
|
9 |
|
10 |
class URLValidator:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def __init__(self):
|
12 |
self.similarity_model = SentenceTransformer('sentence-transformers/all-mpnet-base-v2')
|
13 |
self.fake_news_classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-fake-news-detection")
|
|
|
8 |
# Instantiate the validator
|
9 |
|
10 |
class URLValidator:
|
11 |
+
def rate_url_validity(self, user_query: str, url: str) -> dict:
|
12 |
+
"""Simulates rating the validity of a URL."""
|
13 |
+
content_relevance = random.randint(0, 100)
|
14 |
+
bias_score = random.randint(0, 100)
|
15 |
+
final_validity_score = (content_relevance + bias_score) // 2
|
16 |
+
|
17 |
+
return {
|
18 |
+
"raw_score": {
|
19 |
+
"Content Relevance": content_relevance,
|
20 |
+
"Bias Score": bias_score,
|
21 |
+
"Final Validity Score": final_validity_score
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
def __init__(self):
|
26 |
self.similarity_model = SentenceTransformer('sentence-transformers/all-mpnet-base-v2')
|
27 |
self.fake_news_classifier = pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-fake-news-detection")
|