xianbao commited on
Commit
c03f3f7
·
verified ·
1 Parent(s): 4c10d2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -13
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
- with gr.Blocks() as demo:
9
- repo_id = gr.Textbox(label="Model Scope Repo ID")
10
- hf_token = gr.Textbox(label="Hugging Face token (read/write)")
11
- with gr.Row():
12
- button = gr.Button("Submit", variant="primary")
13
- clear = gr.Button("Clear")
14
- output = gr.Textbox(label="Output")
15
 
16
-
 
 
 
 
17
 
18
- demo.launch(share=True, debug=True)
 
 
 
 
 
 
 
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)