hackerbyhobby
commited on
more updates
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ from deep_translator import GoogleTranslator
|
|
8 |
import shap
|
9 |
import requests
|
10 |
import json
|
|
|
11 |
|
12 |
# Translator instance
|
13 |
translator = GoogleTranslator(source="auto", target="es")
|
@@ -27,15 +28,12 @@ CANDIDATE_LABELS = ["SMiShing", "Other Scam", "Legitimate"]
|
|
27 |
# SHAP explainer setup
|
28 |
explainer = shap.Explainer(classifier)
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
raise ValueError("API key is required to use the application.")
|
36 |
-
return api_key
|
37 |
|
38 |
-
SAFE_BROWSING_API_KEY = get_api_key()
|
39 |
SAFE_BROWSING_URL = "https://safebrowsing.googleapis.com/v4/threatMatches:find"
|
40 |
|
41 |
def check_url_with_google_safebrowsing(url):
|
|
|
8 |
import shap
|
9 |
import requests
|
10 |
import json
|
11 |
+
import os
|
12 |
|
13 |
# Translator instance
|
14 |
translator = GoogleTranslator(source="auto", target="es")
|
|
|
28 |
# SHAP explainer setup
|
29 |
explainer = shap.Explainer(classifier)
|
30 |
|
31 |
+
# Retrieve the Google Safe Browsing API key from the environment
|
32 |
+
SAFE_BROWSING_API_KEY = os.getenv("SAFE_BROWSING_API_KEY")
|
33 |
+
|
34 |
+
if not SAFE_BROWSING_API_KEY:
|
35 |
+
raise ValueError("Google Safe Browsing API key not found. Please set it as an environment variable in your Hugging Face Space.")
|
|
|
|
|
36 |
|
|
|
37 |
SAFE_BROWSING_URL = "https://safebrowsing.googleapis.com/v4/threatMatches:find"
|
38 |
|
39 |
def check_url_with_google_safebrowsing(url):
|