vanhai123 commited on
Commit
8c8de64
·
verified ·
1 Parent(s): 355c18d

Upload 2 files

Browse files
Files changed (2) hide show
  1. serve_model.sh +2 -0
  2. 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())