Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- serve_model.sh +2 -0
- test_predict.py +11 -0
serve_model.sh
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
mlflow models serve -m "models:/SpamClassifier/1" --port 1234
|
test_predict.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import json
|
3 |
+
|
4 |
+
input_text = "Free prize entry now!"
|
5 |
+
data = {"data": [input_text]}
|
6 |
+
|
7 |
+
res = requests.post("http://127.0.0.1:1234/invocations",
|
8 |
+
headers={"Content-Type": "application/json"},
|
9 |
+
data=json.dumps(data))
|
10 |
+
|
11 |
+
print(" Kết quả dự đoán:", res.json())
|