PhaseDOutAI commited on
Commit
b1d7399
·
verified ·
1 Parent(s): de9fd07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1,12 +1,16 @@
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
  # ----------------------------
5
- # CONFIG: Your Hugging Face Token
6
  # ----------------------------
7
- HF_TOKEN = "hf_your_token_here" # Replace with your actual token
8
  MODEL_ID = "openai/gpt-oss-20b"
9
 
 
 
 
10
  # ----------------------------
11
  # CHAT FUNCTION
12
  # ----------------------------
@@ -64,6 +68,5 @@ if __name__ == "__main__":
64
  server_port=7860,
65
  share=True, # Exposes a public URL on Hugging Face
66
  debug=True,
67
- enable_queue=True,
68
- api=True # <-- Exposes /api/predict
69
  )
 
1
+ import os
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
5
  # ----------------------------
6
+ # CONFIG: use HF_TOKEN from Hugging Face secrets
7
  # ----------------------------
8
+ HF_TOKEN = os.environ.get("HF_TOKEN")
9
  MODEL_ID = "openai/gpt-oss-20b"
10
 
11
+ if not HF_TOKEN:
12
+ raise ValueError("HF_TOKEN environment variable not found. Add it in your Space secrets.")
13
+
14
  # ----------------------------
15
  # CHAT FUNCTION
16
  # ----------------------------
 
68
  server_port=7860,
69
  share=True, # Exposes a public URL on Hugging Face
70
  debug=True,
71
+ api=True # <-- Exposes /api/predict for HTML / JS calls
 
72
  )