Spaces:
Sleeping
Sleeping
Update deliverable2.py
Browse files- deliverable2.py +10 -1
deliverable2.py
CHANGED
|
@@ -12,13 +12,22 @@ from bs4 import BeautifulSoup
|
|
| 12 |
from sentence_transformers import SentenceTransformer, util
|
| 13 |
from transformers import pipeline
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
class URLValidator:
|
| 16 |
"""
|
| 17 |
A production-ready URL validation class that evaluates the credibility of a webpage
|
| 18 |
using multiple factors: domain trust, content relevance, fact-checking, bias detection, and citations.
|
| 19 |
"""
|
| 20 |
|
| 21 |
-
def __init__(self):
|
| 22 |
# SerpAPI Key
|
| 23 |
# This api key is acquired from SerpAPI website.
|
| 24 |
self.serpapi_key = SERPAPI_API_KEY
|
|
|
|
| 12 |
from sentence_transformers import SentenceTransformer, util
|
| 13 |
from transformers import pipeline
|
| 14 |
|
| 15 |
+
|
| 16 |
+
SERPAPI_API_KEY = "your_serpapi_key_here"
|
| 17 |
+
validator = URLValidator()
|
| 18 |
+
|
| 19 |
+
import os
|
| 20 |
+
SERPAPI_API_KEY = os.getenv("SERPAPI_API_KEY")
|
| 21 |
+
validator = URLValidator()
|
| 22 |
+
|
| 23 |
+
|
| 24 |
class URLValidator:
|
| 25 |
"""
|
| 26 |
A production-ready URL validation class that evaluates the credibility of a webpage
|
| 27 |
using multiple factors: domain trust, content relevance, fact-checking, bias detection, and citations.
|
| 28 |
"""
|
| 29 |
|
| 30 |
+
def __init__(self,serpapi_key):
|
| 31 |
# SerpAPI Key
|
| 32 |
# This api key is acquired from SerpAPI website.
|
| 33 |
self.serpapi_key = SERPAPI_API_KEY
|