sailfish commited on
Commit
c6fbe87
·
1 Parent(s): 693eb74
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -4,9 +4,24 @@ from huggingface_hub import InferenceClient
4
  """
5
  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
6
  """
7
- client = InferenceClient(model="meta-llama/Llama-3.2-1B")
8
 
 
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  def respond(
12
  message,
@@ -29,6 +44,7 @@ def respond(
29
  response = ""
30
 
31
  for message in client.chat_completion(
 
32
  messages,
33
  max_tokens=max_tokens,
34
  stream=True,
 
4
  """
5
  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
6
  """
 
7
 
8
+ huggingface_token = os.getenv("SECRET_ENV_VARIABLE")
9
+ client = InferenceClient(api_key=huggingface_token)
10
 
11
+ '''
12
+ import requests
13
+
14
+ API_URL = "https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-1B"
15
+ headers = {"Authorization": "Bearer "}
16
+
17
+ def query(payload):
18
+ response = requests.post(API_URL, headers=headers, json=payload)
19
+ return response.json()
20
+
21
+ output = query({
22
+ "inputs": "Can you please let us know more details about your ",
23
+ })
24
+ '''
25
 
26
  def respond(
27
  message,
 
44
  response = ""
45
 
46
  for message in client.chat_completion(
47
+ model="meta-llama/Llama-3.2-1B",
48
  messages,
49
  max_tokens=max_tokens,
50
  stream=True,