|
import gradio as gr |
|
|
|
from huggingface_hub import list_models |
|
|
|
|
|
|
|
|
|
|
|
def list_private_models(oauth_profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str: |
|
if oauth_token is None: |
|
return "Please log in to list private models." |
|
|
|
models = list_models(author=oauth_profile.username, token=oauth_token.token) |
|
|
|
return f"Private models: {', '.join(model.id for model in models if model.private)}" |
|
|
|
with gr.Blocks() as demo: |
|
gr.LoginButton() |
|
gr.LogoutButton() |
|
m1 = gr.Markdown() |
|
demo.load(list_private_models, inputs=None, outputs=m1) |
|
|
|
demo.launch() |
|
|