Spaces:
Runtime error
Runtime error
Commit
·
e952b18
1
Parent(s):
2fc8e08
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,8 @@ def get_completion(inputs, parameters=None, ENDPOINT_URL="http://internal-aws-pr
|
|
23 |
data=json.dumps(data))
|
24 |
return json.loads(response.content.decode("utf-8"))
|
25 |
|
26 |
-
|
|
|
27 |
|
28 |
def image_to_base64_str(pil_image):
|
29 |
byte_arr = io.BytesIO()
|
@@ -36,13 +37,13 @@ def captioner(image):
|
|
36 |
result = get_completion(base64_image)
|
37 |
return result[0]['generated_text']
|
38 |
|
39 |
-
gr.close_all()
|
40 |
-
demo = gr.Interface(fn=captioner,
|
41 |
-
inputs=[gr.Image(label="Upload image", type="pil")],
|
42 |
-
outputs=[gr.Textbox(label="Caption")],
|
43 |
-
title="Image Captioning with BLIP",
|
44 |
-
description="Caption any image using the BLIP model",
|
45 |
-
allow_flagging="never")
|
46 |
|
47 |
|
48 |
|
|
|
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))
|
28 |
|
29 |
def image_to_base64_str(pil_image):
|
30 |
byte_arr = io.BytesIO()
|
|
|
37 |
result = get_completion(base64_image)
|
38 |
return result[0]['generated_text']
|
39 |
|
40 |
+
#gr.close_all()
|
41 |
+
#demo = gr.Interface(fn=captioner,
|
42 |
+
# inputs=[gr.Image(label="Upload image", type="pil")],
|
43 |
+
# outputs=[gr.Textbox(label="Caption")],
|
44 |
+
# title="Image Captioning with BLIP",
|
45 |
+
# description="Caption any image using the BLIP model",
|
46 |
+
# allow_flagging="never")
|
47 |
|
48 |
|
49 |
|