Download app.py from Wauplin/gradio-oauth-private-models: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/spaces/Wauplin/gradio-oauth-private-models/resolve/main/app.py
- Command line
-
hf download hf://spaces/Wauplin/gradio-oauth-private-models/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Wauplin/gradio-oauth-private-models/resolve/main/app.py
668 Bytes
| 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." | |
| # List models from author using token | |
| models = list_models(author=oauth_profile.username, token=oauth_token.token) | |
| # Return list of private models | |
| 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() | |