dlaima commited on
Commit
0847298
·
verified ·
1 Parent(s): 46f4a73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ INFERENCE_ENDPOINT = "https://your-endpoint-url" # Replace with your endpoint U
8
  API_TOKEN = "your-api-token" # Replace with your Hugging Face API token
9
 
10
  #Image-to-text endpoint
11
- def get_completion(inputs, parameters=None, endpoint_url=endpoint_url):
12
  headers = {
13
  "Authorization": f"Bearer {API_TOKEN}",
14
  "Content-Type": "application/json"
@@ -16,7 +16,7 @@ def get_completion(inputs, parameters=None, endpoint_url=endpoint_url):
16
  data = {"inputs": inputs}
17
  if parameters is not None:
18
  data.update({"parameters": parameters})
19
- response = requests.post(INFERENCE_ENDPOINT, headers=headers, data=json.dumps(data))
20
  return json.loads(response.content.decode("utf-8"))
21
 
22
  def get_generation(model, processor, image, dtype):
 
8
  API_TOKEN = "your-api-token" # Replace with your Hugging Face API token
9
 
10
  #Image-to-text endpoint
11
+ def get_completion(inputs, parameters=None, endpoint_url=INFERENCE_ENDPOINT):
12
  headers = {
13
  "Authorization": f"Bearer {API_TOKEN}",
14
  "Content-Type": "application/json"
 
16
  data = {"inputs": inputs}
17
  if parameters is not None:
18
  data.update({"parameters": parameters})
19
+ response = requests.post(endpoint_url, headers=headers, data=json.dumps(data))
20
  return json.loads(response.content.decode("utf-8"))
21
 
22
  def get_generation(model, processor, image, dtype):