Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,22 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import gradio as gr
|
| 3 |
|
| 4 |
-
# Access Hugging Face secret from the environment
|
| 5 |
-
hf_token = os.environ.get('pass') # 'pass' is the name of the secret you set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
# Load the private Space using the secret
|
| 8 |
-
demo = gr.load("peymoon/test", hf_token=hf_token, src="spaces")
|
| 9 |
|
| 10 |
-
# Launch the public-facing interface
|
| 11 |
-
demo.launch()
|
|
|
|
| 1 |
+
# import os
|
| 2 |
+
# import gradio as gr
|
| 3 |
|
| 4 |
+
# # Access Hugging Face secret from the environment
|
| 5 |
+
# hf_token = os.environ.get('pass') # 'pass' is the name of the secret you set
|
| 6 |
+
|
| 7 |
+
# # Load the private Space using the secret
|
| 8 |
+
# demo = gr.load("peymoon/test", hf_token=hf_token, src="spaces")
|
| 9 |
+
|
| 10 |
+
# # Launch the public-facing interface
|
| 11 |
+
# demo.launch()
|
| 12 |
+
from huggingface_hub import HfApi
|
| 13 |
+
|
| 14 |
+
# Use the token from the Secrets Manager
|
| 15 |
+
token = os.environ.get('pass') # Retrieve your stored secret
|
| 16 |
+
|
| 17 |
+
# Use the token to check access to the private Space
|
| 18 |
+
api = HfApi()
|
| 19 |
+
repo_info = api.repo_info(repo_id="peymoon/test", token=token)
|
| 20 |
+
print(repo_info)
|
| 21 |
|
|
|
|
|
|
|
| 22 |
|
|
|
|
|
|