Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
import gradio as gr
|
4 |
-
|
5 |
-
def greet(name):
|
6 |
-
return "Hello " + name + "!"
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
button = gr.Button("Submit", variant="primary")
|
13 |
-
clear = gr.Button("Clear")
|
14 |
-
output = gr.Textbox(label="Output")
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
def hello(profile) -> str:
|
5 |
+
if profile is None:
|
6 |
+
return "I don't know you."
|
7 |
+
return f"Hello {profile.name}"
|
|
|
|
|
|
|
8 |
|
9 |
+
def list_organizations(oauth_token) -> str:
|
10 |
+
if oauth_token is None:
|
11 |
+
return "Please log in to list organizations."
|
12 |
+
org_names = [org["name"] for org in whoami(oauth_token.token)["orgs"]]
|
13 |
+
return f"You belong to {', '.join(org_names)}."
|
14 |
|
15 |
+
with gr.Blocks() as demo:
|
16 |
+
gr.LoginButton()
|
17 |
+
gr.LogoutButton()
|
18 |
+
m1 = gr.Markdown()
|
19 |
+
m2 = gr.Markdown()
|
20 |
+
demo.load(hello, inputs=None, outputs=m1)
|
21 |
+
demo.load(list_organizations, inputs=None, outputs=m2)
|