koenverhagen commited on
Commit
398a38a
1 Parent(s): 60a68a6

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +6 -4
server.py CHANGED
@@ -2,6 +2,7 @@ from fastapi import FastAPI, Response, Request, Header, Form, UploadFile, Body,
2
  from pydantic import BaseModel
3
  from fastapi.responses import FileResponse
4
  from starlette.middleware.cors import CORSMiddleware
 
5
 
6
  from cardtagger import cardtagger
7
 
@@ -55,14 +56,16 @@ def startup_event() :
55
 
56
  @app.get("/")
57
  async def root():
58
- return {"message": "Hello image"}
 
59
 
60
  @app.post("/cardtagger")
61
- async def resolution(request : Request, background_tasks: BackgroundTasks, response : Response, data: UploadFile = Form(...)):
62
 
63
  authorization_token = request.headers.get("Authorization", None)
64
 
65
- check_token = check_auth(authorization_token)
 
66
 
67
  if check_token:
68
 
@@ -82,5 +85,4 @@ async def resolution(request : Request, background_tasks: BackgroundTasks, respo
82
 
83
 
84
 
85
-
86
  #uvicorn server:app --host 0.0.0.0 --port 5050 --workers 4
 
2
  from pydantic import BaseModel
3
  from fastapi.responses import FileResponse
4
  from starlette.middleware.cors import CORSMiddleware
5
+ from starlette.responses import RedirectResponse
6
 
7
  from cardtagger import cardtagger
8
 
 
56
 
57
  @app.get("/")
58
  async def root():
59
+ response = RedirectResponse(url='/docs')
60
+ return response
61
 
62
  @app.post("/cardtagger")
63
+ async def resolution(request : Request, background_tasks: BackgroundTasks, response: Response, data: UploadFile = Form(...)):
64
 
65
  authorization_token = request.headers.get("Authorization", None)
66
 
67
+ # check_token = check_auth(authorization_token)
68
+ check_token = True
69
 
70
  if check_token:
71
 
 
85
 
86
 
87
 
 
88
  #uvicorn server:app --host 0.0.0.0 --port 5050 --workers 4