streetyogi commited on
Commit
dde26ac
·
1 Parent(s): 29829fb

Update inference_server.py

Browse files
Files changed (1) hide show
  1. inference_server.py +9 -1
inference_server.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from sklearn.linear_model import SGDClassifier
2
  import uvicorn
3
  from fastapi import FastAPI
@@ -20,4 +21,11 @@ def train(X):
20
 
21
  @app.get("/")
22
  def read_root(input_text):
23
- return predict(input_text)
 
 
 
 
 
 
 
 
1
+ import logging
2
  from sklearn.linear_model import SGDClassifier
3
  import uvicorn
4
  from fastapi import FastAPI
 
21
 
22
  @app.get("/")
23
  def read_root(input_text):
24
+ logging.info("Received request with input_text: %s"), input_text)
25
+ try:
26
+ result = predict(input_text)
27
+ logging.info("Prediction made: %s", result)
28
+ return result
29
+ except Exception as e:
30
+ logging.error("An error occured: %s", e)
31
+ return {"error": str(e)}