Update app.py
Browse files
app.py
CHANGED
|
@@ -28,6 +28,7 @@ def caption(file, ext):
|
|
| 28 |
return chat_completion.choices[0].message.content
|
| 29 |
def image_predict(image):
|
| 30 |
return caption(image, "png")
|
|
|
|
| 31 |
title = "Generating Captions For Images Using ImCap v1"
|
| 32 |
description = """ImCap v1 uses a varity of image caption generators, then plugs it into LLaMA 2 to get a final caption.<br/>
|
| 33 |
<a href="https://huggingface.co/spaces/SFP/ImCap_v1?duplicate=true"
|
|
@@ -35,5 +36,5 @@ description = """ImCap v1 uses a varity of image caption generators, then plugs
|
|
| 35 |
<img style="margin-bottom: 0em;display: inline;margin-top: -.25em;"
|
| 36 |
src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 37 |
if there is a queue (free CPU works fine as it uses apis)."""
|
| 38 |
-
iface = gr.Interface(image_predict, inputs=gr.Image(type="pil"), outputs="label", flagging_options=[], title=title, description=description)
|
| 39 |
iface.launch(show_api=False)
|
|
|
|
| 28 |
return chat_completion.choices[0].message.content
|
| 29 |
def image_predict(image):
|
| 30 |
return caption(image, "png")
|
| 31 |
+
examples = [["penguin.png"], ["stop.png"], ["stick.png"]]
|
| 32 |
title = "Generating Captions For Images Using ImCap v1"
|
| 33 |
description = """ImCap v1 uses a varity of image caption generators, then plugs it into LLaMA 2 to get a final caption.<br/>
|
| 34 |
<a href="https://huggingface.co/spaces/SFP/ImCap_v1?duplicate=true"
|
|
|
|
| 36 |
<img style="margin-bottom: 0em;display: inline;margin-top: -.25em;"
|
| 37 |
src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 38 |
if there is a queue (free CPU works fine as it uses apis)."""
|
| 39 |
+
iface = gr.Interface(image_predict, inputs=gr.Image(type="pil"), outputs="label", flagging_options=[], title=title, examples=examples, description=description)
|
| 40 |
iface.launch(show_api=False)
|