MoShow commited on
Commit
720b43c
·
verified ·
1 Parent(s): 134635a

Update app.py

Browse files

<audio controls src="https://cdn-uploads.huggingface.co/production/uploads/6743bed2f6b05a786ed5004b/DTHRwHIQTq6XuK8COxuWE.mpga"></audio>

Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,8 +2,10 @@ import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import os
4
 
5
- HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN") # Will pull from env variable (recommended)
 
6
 
 
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=HF_TOKEN)
8
 
9
  def respond(
@@ -34,7 +36,6 @@ def respond(
34
  top_p=top_p,
35
  ):
36
  token = message.choices[0].delta.content
37
-
38
  response += token
39
  yield response
40
 
 
2
  from huggingface_hub import InferenceClient
3
  import os
4
 
5
+ # The token is securely pulled from the Hugging Face Space Secret named HUGGINGFACEHUB_API_TOKEN
6
+ HF_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
7
 
8
+ # Setup the inference client with your model and token
9
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=HF_TOKEN)
10
 
11
  def respond(
 
36
  top_p=top_p,
37
  ):
38
  token = message.choices[0].delta.content
 
39
  response += token
40
  yield response
41