gradio-oauth / app.py
Wauplin's picture
Wauplin HF staff
First oauth test
ccec886
raw
history blame
667 Bytes
import gradio as gr
from auth import get_app
TEMPLATE = """
### Name: {name}
### Username: {preferred_username}
### Profile: {profile}
### Website: {website}
![Profile Picture]({picture})
You can manage your connected applications in your [settings](https://huggingface.co/settings/connected-applications).
"""
def show_profile(request: gr.Request) -> str:
return TEMPLATE.format(**request.request.session["user"])
with gr.Blocks() as demo:
greet_btn = gr.Button("Show profile")
output = gr.Markdown()
greet_btn.click(fn=show_profile, outputs=output)
fastapi_app = get_app()
app = gr.mount_gradio_app(fastapi_app, demo, path="/gradio")