Spaces:
Running
Running
Update utils/functions.py
Browse files- utils/functions.py +5 -10
utils/functions.py
CHANGED
@@ -86,17 +86,12 @@ def get_stats():
|
|
86 |
logging.info("Statystyki zosta艂y pobrane pomy艣lnie.")
|
87 |
return stats
|
88 |
|
89 |
-
def get_statistics():
|
90 |
-
"""Zwraca szczeg贸艂owe statystyki analiz z pliku stats.json."""
|
91 |
-
stats = load_json(STATS_FILE)
|
92 |
-
return stats
|
93 |
-
|
94 |
def get_phone_info(phone_number):
|
95 |
"""Weryfikuje numer telefonu i zwraca informacje o kraju i operatorze."""
|
96 |
try:
|
97 |
parsed_number = phonenumbers.parse(phone_number, None)
|
98 |
-
country = geocoder.description_for_number(parsed_number, 'pl')
|
99 |
-
operator = carrier.name_for_number(parsed_number, 'pl')
|
100 |
if not country:
|
101 |
country = "Nieznany"
|
102 |
if not operator:
|
@@ -133,7 +128,7 @@ def analyze_message(message, phone_number, additional_info, api_key, language):
|
|
133 |
logging.error("Brak klucza API.")
|
134 |
return "Brak klucza API.", "Brak klucza API.", "Brak klucza API."
|
135 |
|
136 |
-
url = "https://api.sambanova.ai/v1/chat/completions"
|
137 |
headers = {
|
138 |
"Authorization": f"Bearer {api_key}",
|
139 |
"Content-Type": "application/json"
|
@@ -268,7 +263,7 @@ You are an advanced AI assistant specializing in identifying fake SMS messages.
|
|
268 |
"""
|
269 |
}
|
270 |
|
271 |
-
system_prompt = system_prompts.get(language, system_prompts['English'])
|
272 |
|
273 |
user_prompt = f"""Analyze the following message for potential fraud:
|
274 |
|
@@ -281,7 +276,7 @@ Additional Information:
|
|
281 |
Provide your analysis and conclusions following the guidelines above."""
|
282 |
|
283 |
payload = {
|
284 |
-
"model": "Meta-Llama-3.1-8B-Instruct",
|
285 |
"messages": [
|
286 |
{"role": "system", "content": system_prompt},
|
287 |
{"role": "user", "content": user_prompt}
|
|
|
86 |
logging.info("Statystyki zosta艂y pobrane pomy艣lnie.")
|
87 |
return stats
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
def get_phone_info(phone_number):
|
90 |
"""Weryfikuje numer telefonu i zwraca informacje o kraju i operatorze."""
|
91 |
try:
|
92 |
parsed_number = phonenumbers.parse(phone_number, None)
|
93 |
+
country = geocoder.description_for_number(parsed_number, 'pl')
|
94 |
+
operator = carrier.name_for_number(parsed_number, 'pl')
|
95 |
if not country:
|
96 |
country = "Nieznany"
|
97 |
if not operator:
|
|
|
128 |
logging.error("Brak klucza API.")
|
129 |
return "Brak klucza API.", "Brak klucza API.", "Brak klucza API."
|
130 |
|
131 |
+
url = "https://api.sambanova.ai/v1/chat/completions"
|
132 |
headers = {
|
133 |
"Authorization": f"Bearer {api_key}",
|
134 |
"Content-Type": "application/json"
|
|
|
263 |
"""
|
264 |
}
|
265 |
|
266 |
+
system_prompt = system_prompts.get(language, system_prompts['English'])
|
267 |
|
268 |
user_prompt = f"""Analyze the following message for potential fraud:
|
269 |
|
|
|
276 |
Provide your analysis and conclusions following the guidelines above."""
|
277 |
|
278 |
payload = {
|
279 |
+
"model": "Meta-Llama-3.1-8B-Instruct",
|
280 |
"messages": [
|
281 |
{"role": "system", "content": system_prompt},
|
282 |
{"role": "user", "content": user_prompt}
|