Spaces:
Runtime error
Runtime error
Download app.py from hmb/required_token_test: direct link, hf CLI and curl.
- Browser
- Download file 477 Bytes
-
https://huggingface.co/spaces/hmb/required_token_test/resolve/main/app.py
- Command line
-
hf download hf://spaces/hmb/required_token_test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hmb/required_token_test/resolve/main/app.py
477 Bytes
| import os | |
| import gradio as gr | |
| hf_token = os.getenv('TEST_TOKEN') | |
| print(f"Hugging Face token: {hf_token}") | |
| if hf_token is None: | |
| raise ValueError("Hugging Face token not found") | |
| with gr.Blocks() as demo: | |
| token_input = gr.Textbox(label="Important token", value=hf_token) | |
| output = gr.Textbox(label="Important token output") | |
| btn = gr.Button("Submit") | |
| btn.click(lambda x:x, inputs=token_input, outputs=[output]) | |
| if __name__ == "__main__": | |
| demo.launch() | |