Spaces:
Runtime error
Runtime error
Commit ·
378b151
1
Parent(s): 07b2fc3
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,19 +9,19 @@ import base64
|
|
| 9 |
demo = gr.Textbox(get_completion(os.environ['HF_TOKENS']))
|
| 10 |
|
| 11 |
#Image-to-text endpoint
|
| 12 |
-
def get_completion(inputs, parameters=None, ENDPOINT_URL="http://internal-aws-prod-internal-revproxy-alb-11660607.us-west-1.elb.amazonaws.com/rev-proxy/huggingface/itt"):
|
| 13 |
-
headers = {
|
| 14 |
-
"Authorization": f"Bearer {os.environ['HF_TOKENS']}",
|
| 15 |
-
"Content-Type": "application/json"
|
| 16 |
-
}
|
| 17 |
-
data = { "inputs": inputs }
|
| 18 |
-
if parameters is not None:
|
| 19 |
-
data.update({"parameters": parameters})
|
| 20 |
-
response = requests.request("POST",
|
| 21 |
-
ENDPOINT_URL,
|
| 22 |
-
headers=headers,
|
| 23 |
-
data=json.dumps(data))
|
| 24 |
-
return json.loads(response.content.decode("utf-8"))
|
| 25 |
|
| 26 |
#image_url = "https://free-images.com/sm/9596/dog_animal_greyhound_983023.jpg"
|
| 27 |
#demo = gr.Textbox(get_completion(image_url))
|
|
|
|
| 9 |
demo = gr.Textbox(get_completion(os.environ['HF_TOKENS']))
|
| 10 |
|
| 11 |
#Image-to-text endpoint
|
| 12 |
+
#def get_completion(inputs, parameters=None, ENDPOINT_URL="http://internal-aws-prod-internal-revproxy-alb-11660607.us-west-1.elb.amazonaws.com/rev-proxy/huggingface/itt"):
|
| 13 |
+
# headers = {
|
| 14 |
+
# "Authorization": f"Bearer {os.environ['HF_TOKENS']}",
|
| 15 |
+
# "Content-Type": "application/json"
|
| 16 |
+
# }
|
| 17 |
+
# data = { "inputs": inputs }
|
| 18 |
+
# if parameters is not None:
|
| 19 |
+
# data.update({"parameters": parameters})
|
| 20 |
+
# response = requests.request("POST",
|
| 21 |
+
# ENDPOINT_URL,
|
| 22 |
+
# headers=headers,
|
| 23 |
+
# data=json.dumps(data))
|
| 24 |
+
# return json.loads(response.content.decode("utf-8"))
|
| 25 |
|
| 26 |
#image_url = "https://free-images.com/sm/9596/dog_animal_greyhound_983023.jpg"
|
| 27 |
#demo = gr.Textbox(get_completion(image_url))
|