File size: 667 Bytes
ccec886
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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")