kristinazk commited on
Commit
0cafa25
·
verified ·
1 Parent(s): 21bce75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -1,15 +1,13 @@
1
  import io
2
  import torch
3
 
4
- from fastapi import FastAPI, File, UploadFile, HTTPException, APIRouter
5
  from fastapi.responses import StreamingResponse
6
  from PIL import Image
7
  from RealESRGAN import RealESRGAN
8
 
9
  app = FastAPI()
10
 
11
- router = APIRouter()
12
-
13
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
14
  model = RealESRGAN(device, scale=2)
15
  model.load_weights("weights/RealESRGAN_x2.pth", download=True)
@@ -37,6 +35,3 @@ async def enhance_img(file: UploadFile = File(...)):
37
 
38
  except Exception as e:
39
  raise HTTPException(500, detail=str(e))
40
-
41
-
42
- app.include_router(router, prefix="/api")
 
1
  import io
2
  import torch
3
 
4
+ from fastapi import FastAPI, File, UploadFile, HTTPException
5
  from fastapi.responses import StreamingResponse
6
  from PIL import Image
7
  from RealESRGAN import RealESRGAN
8
 
9
  app = FastAPI()
10
 
 
 
11
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
12
  model = RealESRGAN(device, scale=2)
13
  model.load_weights("weights/RealESRGAN_x2.pth", download=True)
 
35
 
36
  except Exception as e:
37
  raise HTTPException(500, detail=str(e))