Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,11 @@ def hello(profile: gr.OAuthProfile | None) -> str:
|
|
9 |
return "I don't know you."
|
10 |
return f"Hello {profile.name}"
|
11 |
|
12 |
-
def message(message,history):
|
13 |
-
|
|
|
|
|
|
|
14 |
|
15 |
def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
|
16 |
# ^ expect a gr.OAuthToken object as input to get the user's token
|
@@ -26,19 +29,15 @@ def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthTo
|
|
26 |
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.Markdown(
|
29 |
-
"
|
30 |
-
"\n\nThis Space is a demo for the **Sign in with Hugging Face** feature. "
|
31 |
-
"Duplicate this Space to get started."
|
32 |
-
"\n\nFor more details, check out:"
|
33 |
-
"\n- https://www.gradio.app/guides/sharing-your-app#o-auth-login-via-hugging-face"
|
34 |
-
"\n- https://huggingface.co/docs/hub/spaces-oauth"
|
35 |
)
|
36 |
gr.ChatInterface(message)
|
|
|
37 |
gr.LoginButton()
|
38 |
# ^ add a login button to the Space
|
39 |
-
m1 = gr.Markdown()
|
40 |
-
m2 = gr.Markdown()
|
41 |
-
demo.load(hello, inputs=None, outputs=m1)
|
42 |
-
demo.load(list_private_models, inputs=None, outputs=m2)
|
43 |
|
44 |
demo.launch()
|
|
|
9 |
return "I don't know you."
|
10 |
return f"Hello {profile.name}"
|
11 |
|
12 |
+
def message(message,history,profile: gr.OAuthProfile | None):
|
13 |
+
if profile is None:
|
14 |
+
raise gr.Error("Please login to...")
|
15 |
+
return
|
16 |
+
return f"hello {profile.name}"
|
17 |
|
18 |
def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
|
19 |
# ^ expect a gr.OAuthToken object as input to get the user's token
|
|
|
29 |
|
30 |
with gr.Blocks() as demo:
|
31 |
gr.Markdown(
|
32 |
+
"This is GPT-4o, loin to use it!"
|
|
|
|
|
|
|
|
|
|
|
33 |
)
|
34 |
gr.ChatInterface(message)
|
35 |
+
|
36 |
gr.LoginButton()
|
37 |
# ^ add a login button to the Space
|
38 |
+
# m1 = gr.Markdown()
|
39 |
+
# m2 = gr.Markdown()
|
40 |
+
# demo.load(hello, inputs=None, outputs=m1)
|
41 |
+
# demo.load(list_private_models, inputs=None, outputs=m2)
|
42 |
|
43 |
demo.launch()
|