Abhishek Thakur
commited on
Commit
·
eb49ce1
1
Parent(s):
4be68a0
/oauth_login
Browse files- competitions/app.py +4 -1
- competitions/templates/index.html +1 -1
competitions/app.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3 |
import threading
|
4 |
|
5 |
from fastapi import FastAPI, File, Form, Request, UploadFile
|
6 |
-
from fastapi.responses import HTMLResponse, JSONResponse
|
7 |
from fastapi.staticfiles import StaticFiles
|
8 |
from fastapi.templating import Jinja2Templates
|
9 |
from huggingface_hub import hf_hub_download
|
@@ -96,6 +96,9 @@ async def read_form(request: Request):
|
|
96 |
}
|
97 |
return templates.TemplateResponse("index.html", context)
|
98 |
|
|
|
|
|
|
|
99 |
|
100 |
@app.get("/use_oauth", response_class=JSONResponse)
|
101 |
async def use_oauth(request: Request):
|
|
|
3 |
import threading
|
4 |
|
5 |
from fastapi import FastAPI, File, Form, Request, UploadFile
|
6 |
+
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
7 |
from fastapi.staticfiles import StaticFiles
|
8 |
from fastapi.templating import Jinja2Templates
|
9 |
from huggingface_hub import hf_hub_download
|
|
|
96 |
}
|
97 |
return templates.TemplateResponse("index.html", context)
|
98 |
|
99 |
+
@app.get("/oauth_login", response_class=HTMLResponse)
|
100 |
+
return RedirectResponse("/login/huggingface")
|
101 |
+
|
102 |
|
103 |
@app.get("/use_oauth", response_class=JSONResponse)
|
104 |
async def use_oauth(request: Request):
|
competitions/templates/index.html
CHANGED
@@ -388,7 +388,7 @@
|
|
388 |
class="mt-1 block w-full border border-gray-300 px-3 py-1.5 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
389 |
</li>
|
390 |
<li id="loginButton" style="display: none;">
|
391 |
-
<a href="/
|
392 |
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Login with Hugging
|
393 |
Face</a>
|
394 |
</li>
|
|
|
388 |
class="mt-1 block w-full border border-gray-300 px-3 py-1.5 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
389 |
</li>
|
390 |
<li id="loginButton" style="display: none;">
|
391 |
+
<a href="/oauth_login"
|
392 |
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Login with Hugging
|
393 |
Face</a>
|
394 |
</li>
|