adding tests
Browse files- test_hate.py +17 -0
- test_spam.py +17 -0
- test_toxic.py +17 -0
test_hate.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
url = "https://Propvia-Testing.hf.space/hate"
|
| 4 |
+
|
| 5 |
+
payload = {"text": "You are a loser! I hate you!"}
|
| 6 |
+
|
| 7 |
+
response = requests.post(url, json=payload)
|
| 8 |
+
data = response.json()
|
| 9 |
+
|
| 10 |
+
print("Status:", response.status_code)
|
| 11 |
+
try:
|
| 12 |
+
print("JSON:", response.json())
|
| 13 |
+
except Exception:
|
| 14 |
+
print("Raw text:", response.text)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
print(data['label'])
|
test_spam.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
url = "https://Propvia-Testing.hf.space/spam"
|
| 4 |
+
|
| 5 |
+
payload = {"text": "Congratulations you have won $1000! Click the link to claim your prize!"}
|
| 6 |
+
|
| 7 |
+
response = requests.post(url, json=payload)
|
| 8 |
+
data = response.json()
|
| 9 |
+
|
| 10 |
+
print("Status:", response.status_code)
|
| 11 |
+
try:
|
| 12 |
+
print("JSON:", response.json())
|
| 13 |
+
except Exception:
|
| 14 |
+
print("Raw text:", response.text)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
print(data['label'])
|
test_toxic.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
|
| 3 |
+
url = "https://Propvia-Testing.hf.space/toxic"
|
| 4 |
+
|
| 5 |
+
payload = {"text": "You are a loser!"}
|
| 6 |
+
|
| 7 |
+
response = requests.post(url, json=payload)
|
| 8 |
+
data = response.json()
|
| 9 |
+
|
| 10 |
+
print("Status:", response.status_code)
|
| 11 |
+
try:
|
| 12 |
+
print("JSON:", response.json())
|
| 13 |
+
except Exception:
|
| 14 |
+
print("Raw text:", response.text)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
print(data['label'])
|