AbbaStatistician commited on
Commit
3d1c3ea
·
verified ·
1 Parent(s): 26e0101

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -1,3 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
  demo = gr.load("spaces/StatsTech/StatsEasy")
 
1
+ import gradio as gr
2
+ import os
3
+
4
+ # 1. This securely reads the token you just saved in the Space's settings.
5
+ # The token itself is NOT in the code.
6
+ hf_token = os.environ.get("HF_TOKEN")
7
+
8
+ if not hf_token:
9
+ raise ValueError("HF_TOKEN secret is not set. Please add it to your Space settings.")
10
+
11
+ # 2. This uses your secret token to "unlock" and load your private Space.
12
+ print(f"Attempting to load private Space: spaces/StatsTech/StatsEasy")
13
+ demo = gr.load("spaces/StatsTech/StatsEasy", hf_token=hf_token)
14
+ print("Private Space loaded successfully.")
15
+
16
+ # 3. This launches the loaded app.
17
+ demo.launch()
18
+
19
  import gradio as gr
20
 
21
  demo = gr.load("spaces/StatsTech/StatsEasy")