Spaces:
Sleeping
Sleeping
Download server.py from horaizon27/fhe_aging_pace: direct link, hf CLI and curl.
- Browser
- Download file 824 Bytes
-
https://huggingface.co/spaces/horaizon27/fhe_aging_pace/resolve/main/server.py
- Command line
-
hf download hf://spaces/horaizon27/fhe_aging_pace/server.py
-
curl -L -o server.py https://huggingface.co/spaces/horaizon27/fhe_aging_pace/resolve/main/server.py
824 Bytes
| from typing import List | |
| from fastapi import FastAPI, File, UploadFile | |
| from fastapi.responses import Response | |
| import common | |
| from fhe_utils import FHEServer | |
| FHE_SERVER = FHEServer(common.ROOT_DIR / "server.zip") | |
| print (FHE_SERVER.server.is_simulated) | |
| # Initialize an instance of FastAPI | |
| app = FastAPI() | |
| # Define the default route | |
| def root(): | |
| return {"message": "Welcome to the Server!"} | |
| def pace_estimation( | |
| files: List[UploadFile] = File(), | |
| ): | |
| encrypted_betas = files[0].file.read() | |
| encrypted_weights = files[1].file.read() | |
| encrypted_intercept = files[2].file.read() | |
| evaluation_key = files[3].file.read() | |
| encrypted_pace = FHE_SERVER.run(encrypted_betas, encrypted_weights, encrypted_intercept, evaluation_key) | |
| return Response(encrypted_pace) |