davanstrien HF staff commited on
Commit
c0cfc84
1 Parent(s): 6ac4ade

Add root endpoint redirect to /docs

Browse files
Files changed (1) hide show
  1. main.py +6 -1
main.py CHANGED
@@ -10,7 +10,7 @@ import json
10
  from contextlib import asynccontextmanager
11
  from datetime import datetime
12
  from pathlib import Path
13
-
14
  from huggingface_hub import CommitScheduler
15
 
16
  load_dotenv()
@@ -68,6 +68,11 @@ def save_vote(vote_entry):
68
  file.write("\n")
69
 
70
 
 
 
 
 
 
71
  @app.post("/vote")
72
  async def receive_vote(vote: Vote, background_tasks: BackgroundTasks):
73
  vote_entry = {
 
10
  from contextlib import asynccontextmanager
11
  from datetime import datetime
12
  from pathlib import Path
13
+ from starlette.responses import RedirectResponse
14
  from huggingface_hub import CommitScheduler
15
 
16
  load_dotenv()
 
68
  file.write("\n")
69
 
70
 
71
+ @app.get("/", include_in_schema=False)
72
+ def root():
73
+ return RedirectResponse(url="/docs")
74
+
75
+
76
  @app.post("/vote")
77
  async def receive_vote(vote: Vote, background_tasks: BackgroundTasks):
78
  vote_entry = {