Spaces:
Build error
Build error
Update server.py
Browse files
server.py
CHANGED
|
@@ -6,11 +6,14 @@ from pydantic import BaseModel
|
|
| 6 |
import base64
|
| 7 |
from pathlib import Path
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
current_dir = Path(__file__).parent
|
| 10 |
|
| 11 |
# Load the model
|
| 12 |
fhe_model = FHEModelServer("deployment/financial_rating")
|
| 13 |
-
|
| 14 |
class PredictRequest(BaseModel):
|
| 15 |
evaluation_key: str
|
| 16 |
encrypted_encoding: str
|
|
@@ -25,8 +28,6 @@ def root():
|
|
| 25 |
|
| 26 |
@app.post("/predict_sentiment")
|
| 27 |
def predict_sentiment(query: PredictRequest):
|
| 28 |
-
fhe_model = FHEModelServer("deployment/financial_rating")
|
| 29 |
-
|
| 30 |
encrypted_encoding = base64.b64decode(query.encrypted_encoding)
|
| 31 |
evaluation_key = base64.b64decode(query.evaluation_key)
|
| 32 |
prediction = fhe_model.run(encrypted_encoding, evaluation_key)
|
|
|
|
| 6 |
import base64
|
| 7 |
from pathlib import Path
|
| 8 |
|
| 9 |
+
current_dir = Path(__file__).parent
|
| 10 |
+
|
| 11 |
+
|
| 12 |
current_dir = Path(__file__).parent
|
| 13 |
|
| 14 |
# Load the model
|
| 15 |
fhe_model = FHEModelServer("deployment/financial_rating")
|
| 16 |
+
|
| 17 |
class PredictRequest(BaseModel):
|
| 18 |
evaluation_key: str
|
| 19 |
encrypted_encoding: str
|
|
|
|
| 28 |
|
| 29 |
@app.post("/predict_sentiment")
|
| 30 |
def predict_sentiment(query: PredictRequest):
|
|
|
|
|
|
|
| 31 |
encrypted_encoding = base64.b64decode(query.encrypted_encoding)
|
| 32 |
evaluation_key = base64.b64decode(query.evaluation_key)
|
| 33 |
prediction = fhe_model.run(encrypted_encoding, evaluation_key)
|