gregorlied commited on
Commit
d84bb55
·
verified ·
1 Parent(s): cbd44c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import spaces
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
@@ -5,8 +6,9 @@ from huggingface_hub import InferenceClient
5
  """
6
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
7
  """
8
- model_name = "meta-llama/Llama-3.2-1B-Instruct"
9
- client = InferenceClient(model_name)
 
10
 
11
  @spaces.GPU(duration=60)
12
  def respond(
@@ -29,7 +31,7 @@ def respond(
29
 
30
  response = ""
31
 
32
- for message in client.chat_completion(
33
  messages,
34
  max_tokens=max_tokens,
35
  stream=True,
 
1
+ import os
2
  import spaces
3
  import gradio as gr
4
  from huggingface_hub import InferenceClient
 
6
  """
7
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
8
  """
9
+ HF_TOKEN = os.getenv("HF_TOKEN")
10
+
11
+ client = InferenceClient(model_name, api_key=HF_TOKEN)
12
 
13
  @spaces.GPU(duration=60)
14
  def respond(
 
31
 
32
  response = ""
33
 
34
+ for message in client.chat_completion.create(
35
  messages,
36
  max_tokens=max_tokens,
37
  stream=True,