Spaces:
Sleeping
Sleeping
update
Browse files
README.md
CHANGED
@@ -4,7 +4,7 @@ emoji: 🏆
|
|
4 |
colorFrom: pink
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
hf_oauth: true
|
9 |
hf_oauth_scopes:
|
10 |
- email
|
|
|
4 |
colorFrom: pink
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.14.0
|
8 |
hf_oauth: true
|
9 |
hf_oauth_scopes:
|
10 |
- email
|
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
from huggingface_hub import
|
3 |
|
4 |
|
5 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
@@ -7,11 +7,14 @@ def hello(profile: gr.OAuthProfile | None) -> str:
|
|
7 |
return "I don't know you."
|
8 |
return f"Hello {profile.name}"
|
9 |
|
10 |
-
def
|
11 |
if oauth_token is None:
|
12 |
-
return "Please log in to list
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
with gr.Blocks() as demo:
|
17 |
gr.Markdown(
|
@@ -22,6 +25,6 @@ with gr.Blocks() as demo:
|
|
22 |
m1 = gr.Markdown()
|
23 |
m2 = gr.Markdown()
|
24 |
demo.load(hello, inputs=None, outputs=m1)
|
25 |
-
demo.load(
|
26 |
|
27 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from huggingface_hub import list_models
|
3 |
|
4 |
|
5 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
|
7 |
return "I don't know you."
|
8 |
return f"Hello {profile.name}"
|
9 |
|
10 |
+
def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
|
11 |
if oauth_token is None:
|
12 |
+
return "Please log in to list private models."
|
13 |
+
models = [
|
14 |
+
f"{model.id} ({'private' if model.private else 'public'})"
|
15 |
+
for model in list_models(author=profile.username, token=oauth_token.token)
|
16 |
+
]
|
17 |
+
return "Models:\n\n" + "\n - ".join(models) + "."
|
18 |
|
19 |
with gr.Blocks() as demo:
|
20 |
gr.Markdown(
|
|
|
25 |
m1 = gr.Markdown()
|
26 |
m2 = gr.Markdown()
|
27 |
demo.load(hello, inputs=None, outputs=m1)
|
28 |
+
demo.load(list_private_models, inputs=None, outputs=m2)
|
29 |
|
30 |
demo.launch()
|