Skip to content

Commit

Permalink
Clean up api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GearKite committed Mar 5, 2024
1 parent e0391e6 commit 19c291c
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gc
import json

from fastapi import FastAPI, Response, UploadFile
from fastapi import FastAPI, HTTPException, Response, UploadFile

from . import blur

Expand Down Expand Up @@ -31,26 +31,22 @@ async def blur_picture(picture: UploadFile, keep=0):
return Response(content=blurredPic, media_type="image/jpeg", headers=headers)


@app.get(
"/blur/", responses={200: {"content": {"text/html": {}}}}, response_class=Response
@app.api_route(
"/blur/",
responses={200: {"content": {"text/html": {}}}},
response_class=Response,
methods=["GET", "HEAD"],
)
async def blur_form():
return Response(content=open("demo.html", "rb").read(), media_type="text/html")


@app.head(
"/blur/", responses={200: {"content": {"text/html": {}}}}, response_class=Response
)
async def blur_form():
return


@app.post(
"/deblur/",
responses={200: {"content": {"image/jpeg": {}}}},
response_class=Response,
)
async def blur_picture(picture: UploadFile, idx: int, salt=""):
async def deblur_picture(picture: UploadFile, idx: int, salt=""):
deblurredPic = blur.deblurPicture(picture, idx, salt)

# For some reason garbage collection does not run automatically after
Expand Down

0 comments on commit 19c291c

Please sign in to comment.