File size: 381 Bytes
0f55af6
 
b688aca
 
 
 
 
0f55af6
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from fastapi import FastAPI, Request
from huggingface_hub._oauth import attach_huggingface_oauth, parse_huggingface_oauth

app = FastAPI()

@app.get("/")
def greet_json():
    return {"Hello": "World!"}

@app.get("/me")
def greet_json(request: Request):
    oauth = parse_huggingface_oauth(request)
    print(oauth)
    return {"Hello": print(oauth)}

attach_huggingface_oauth(app)