Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,13 +5,10 @@ from fastapi import FastAPI, UploadFile, File
|
|
| 5 |
from fastapi.responses import JSONResponse
|
| 6 |
from pydantic import BaseModel
|
| 7 |
|
| 8 |
-
# Allowlist the required global for PyTorch model loading
|
| 9 |
-
torch.serialization.add_safe_globals(['cloudpickle.cloudpickle._make_skeleton_class'])
|
| 10 |
-
|
| 11 |
app = FastAPI()
|
| 12 |
|
| 13 |
# Load the pre-trained model from within the container
|
| 14 |
-
model_uri = "
|
| 15 |
model = torch.load(model_uri, weights_only=True)
|
| 16 |
|
| 17 |
# Define input schema for JSON requests
|
|
|
|
| 5 |
from fastapi.responses import JSONResponse
|
| 6 |
from pydantic import BaseModel
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
app = FastAPI()
|
| 9 |
|
| 10 |
# Load the pre-trained model from within the container
|
| 11 |
+
model_uri = "model.pth"
|
| 12 |
model = torch.load(model_uri, weights_only=True)
|
| 13 |
|
| 14 |
# Define input schema for JSON requests
|