Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload 2 files
Browse files
server.py
CHANGED
@@ -10,19 +10,32 @@ import uvicorn
|
|
10 |
|
11 |
current_dir = Path(__file__).parent
|
12 |
print('1111', current_dir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
# Load the model
|
14 |
fhe_model = FHEModelServer(
|
15 |
Path.joinpath(current_dir, "fhe_model")
|
16 |
)
|
17 |
print(Path.joinpath(current_dir, "fhe_model"))
|
18 |
print(fhe_model)
|
|
|
19 |
class PredictRequest(BaseModel):
|
20 |
evaluation_key: str
|
21 |
encrypted_encoding: str
|
22 |
|
23 |
|
24 |
-
# Initialize an instance of FastAPI
|
25 |
-
app = FastAPI()
|
26 |
|
27 |
|
28 |
# Define the default route
|
|
|
10 |
|
11 |
current_dir = Path(__file__).parent
|
12 |
print('1111', current_dir)
|
13 |
+
|
14 |
+
# Initialize an instance of FastAPI
|
15 |
+
app = FastAPI()
|
16 |
+
|
17 |
+
@app.get("/")
|
18 |
+
def root():
|
19 |
+
"""
|
20 |
+
Root endpoint of the health prediction API.
|
21 |
+
Returns:
|
22 |
+
dict: The welcome message.
|
23 |
+
"""
|
24 |
+
return {"message": "Welcome to your disease prediction with FHE!"}
|
25 |
+
|
26 |
+
|
27 |
# Load the model
|
28 |
fhe_model = FHEModelServer(
|
29 |
Path.joinpath(current_dir, "fhe_model")
|
30 |
)
|
31 |
print(Path.joinpath(current_dir, "fhe_model"))
|
32 |
print(fhe_model)
|
33 |
+
|
34 |
class PredictRequest(BaseModel):
|
35 |
evaluation_key: str
|
36 |
encrypted_encoding: str
|
37 |
|
38 |
|
|
|
|
|
39 |
|
40 |
|
41 |
# Define the default route
|