Spaces:
Runtime error
Runtime error
chats-bug
commited on
Commit
•
bc65b96
1
Parent(s):
8ca734f
Removed typing
Browse files
app.py
CHANGED
@@ -5,9 +5,9 @@ from model import GitBaseCocoModel
|
|
5 |
|
6 |
|
7 |
def generate_captions(
|
8 |
-
image
|
9 |
-
max_len
|
10 |
-
num_captions
|
11 |
):
|
12 |
"""
|
13 |
Generates captions for the given image.
|
@@ -36,22 +36,19 @@ def generate_captions(
|
|
36 |
caption = "\n".join(caption)
|
37 |
return caption
|
38 |
|
39 |
-
|
40 |
-
inputs = [
|
41 |
-
gr.inputs.Image(type="pil", label="Image"),
|
42 |
-
gr.inputs.Slider(minimum=20, maximum=100, step=5, default=50, label="Maximum Caption Length"),
|
43 |
-
gr.inputs.Slider(minimum=1, maximum=10, step=1, default=1, label="Number of Captions to Generate"),
|
44 |
-
]
|
45 |
-
# Determine the number of outputs based on the number of captions to generate.
|
46 |
-
outputs = gr.outputs.Textbox(label="Captions")
|
47 |
-
|
48 |
title = "Git-Base-COCO Image Captioning"
|
49 |
description = "A model for generating captions for images."
|
50 |
|
51 |
interface = gr.Interface(
|
52 |
fn=generate_captions,
|
53 |
-
inputs=
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
title=title,
|
56 |
description=description,
|
57 |
)
|
|
|
5 |
|
6 |
|
7 |
def generate_captions(
|
8 |
+
image,
|
9 |
+
max_len,
|
10 |
+
num_captions,
|
11 |
):
|
12 |
"""
|
13 |
Generates captions for the given image.
|
|
|
36 |
caption = "\n".join(caption)
|
37 |
return caption
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
title = "Git-Base-COCO Image Captioning"
|
40 |
description = "A model for generating captions for images."
|
41 |
|
42 |
interface = gr.Interface(
|
43 |
fn=generate_captions,
|
44 |
+
inputs=[
|
45 |
+
gr.inputs.Image(type="pil", label="Image"),
|
46 |
+
gr.inputs.Slider(minimum=20, maximum=100, step=5, default=50, label="Maximum Caption Length"),
|
47 |
+
gr.inputs.Slider(minimum=1, maximum=10, step=1, default=1, label="Number of Captions to Generate"),
|
48 |
+
],
|
49 |
+
outputs=[
|
50 |
+
gr.outputs.Textbox(label="Caption"),
|
51 |
+
],
|
52 |
title=title,
|
53 |
description=description,
|
54 |
)
|