Abhishek Thakur
commited on
Commit
·
f4e9090
1
Parent(s):
6cdb208
fix oauth
Browse files- competitions/app.py +0 -6
competitions/app.py
CHANGED
@@ -2,7 +2,6 @@ import datetime
|
|
2 |
import os
|
3 |
import threading
|
4 |
|
5 |
-
import requests
|
6 |
from fastapi import FastAPI, File, Form, Request, UploadFile
|
7 |
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
8 |
from fastapi.staticfiles import StaticFiles
|
@@ -89,11 +88,6 @@ async def read_form(request: Request):
|
|
89 |
"""
|
90 |
if USE_OAUTH == 1:
|
91 |
logger.info(request.session.get("oauth_info"))
|
92 |
-
oauth_info = request.session.get("oauth_info")
|
93 |
-
access_token = oauth_info["access_token"]
|
94 |
-
oauth_userinfo_endpoint = "https://huggingface.co/oauth/userinfo"
|
95 |
-
res = requests.post(oauth_userinfo_endpoint, headers={"Authorization": f"Bearer {access_token}"}, timeout=10)
|
96 |
-
oauth_info["_userinfo"] = res.json()
|
97 |
if HF_TOKEN is None:
|
98 |
return templates.TemplateResponse("error.html", {"request": request})
|
99 |
context = {
|
|
|
2 |
import os
|
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
|
|
|
88 |
"""
|
89 |
if USE_OAUTH == 1:
|
90 |
logger.info(request.session.get("oauth_info"))
|
|
|
|
|
|
|
|
|
|
|
91 |
if HF_TOKEN is None:
|
92 |
return templates.TemplateResponse("error.html", {"request": request})
|
93 |
context = {
|