Spaces:
Sleeping
Sleeping
Jathin Chetty commited on
Commit ·
1dfa093
1
Parent(s): f7a8d72
Update model path
Browse files- test_hf_api.py +16 -0
- webapp/app.py +1 -1
test_hf_api.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
API_URL = "https://api-inference.huggingface.co/models/Jathin-ch/hate_speech_multilingual"
|
| 5 |
+
headers = {} # No token for now, let's see if it works at all
|
| 6 |
+
|
| 7 |
+
def query(payload):
|
| 8 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 9 |
+
return response.json()
|
| 10 |
+
|
| 11 |
+
output = query({"inputs": "I hate you so much!"})
|
| 12 |
+
print("Result for Jathin-ch:", output)
|
| 13 |
+
|
| 14 |
+
API_URL2 = "https://api-inference.huggingface.co/models/IMSyPP/hate_speech_multilingual"
|
| 15 |
+
output2 = requests.post(API_URL2, headers=headers, json={"inputs": "I hate you so much!"}).json()
|
| 16 |
+
print("Result for IMSyPP:", output2)
|
webapp/app.py
CHANGED
|
@@ -37,4 +37,4 @@ def api_predict():
|
|
| 37 |
if __name__ == '__main__':
|
| 38 |
print("Starting Flask application...")
|
| 39 |
print(f"Running from directory: {os.getcwd()}")
|
| 40 |
-
app.run(debug=True, port=
|
|
|
|
| 37 |
if __name__ == '__main__':
|
| 38 |
print("Starting Flask application...")
|
| 39 |
print(f"Running from directory: {os.getcwd()}")
|
| 40 |
+
app.run(debug=True, port=8080)
|