File size: 815 Bytes
2b4b309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import gradio as gr
from gradio.oauth import (
    OAUTH_CLIENT_ID,
    OAUTH_CLIENT_SECRET,
    OAUTH_SCOPES,
    OPENID_PROVIDER_URL,
    get_space,
)

if (
    all(
        [
            OAUTH_CLIENT_ID,
            OAUTH_CLIENT_SECRET,
            OAUTH_SCOPES,
            OPENID_PROVIDER_URL,
        ]
    )
    or get_space() is None
):
    from gradio.oauth import OAuthToken
else:
    OAuthToken = str


def get_login_button():
    if (
        all(
            [
                OAUTH_CLIENT_ID,
                OAUTH_CLIENT_SECRET,
                OAUTH_SCOPES,
                OPENID_PROVIDER_URL,
            ]
        )
        or get_space() is None
    ):
        return gr.LoginButton(
            value="Sign in with Hugging Face - a login will reset the data!",
            size="lg",
        )