Commit ·
8cdcd82
1
Parent(s): 55955aa
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,10 @@ def generate_caption(image_file):
|
|
| 17 |
|
| 18 |
# Generate captions using the Blip-Caption model
|
| 19 |
captions = model.generate({"image": image}, use_nucleus_sampling=True, num_captions=5)
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Set up the Gradio interface
|
| 23 |
#inputs = gr.inputs.Image(type="pil",label="Image")
|
|
@@ -25,4 +28,4 @@ def generate_caption(image_file):
|
|
| 25 |
interface = gr.Interface(fn=generate_caption, inputs="image", outputs="text", title="Blip-Caption")
|
| 26 |
|
| 27 |
# Launch the interface
|
| 28 |
-
interface.launch()
|
|
|
|
| 17 |
|
| 18 |
# Generate captions using the Blip-Caption model
|
| 19 |
captions = model.generate({"image": image}, use_nucleus_sampling=True, num_captions=5)
|
| 20 |
+
beautified_captions = [caption.capitalize() for caption in captions]
|
| 21 |
+
beautified_captions_str = "\n".join(beautified_captions)
|
| 22 |
+
|
| 23 |
+
return beautified_captions_str
|
| 24 |
|
| 25 |
# Set up the Gradio interface
|
| 26 |
#inputs = gr.inputs.Image(type="pil",label="Image")
|
|
|
|
| 28 |
interface = gr.Interface(fn=generate_caption, inputs="image", outputs="text", title="Blip-Caption")
|
| 29 |
|
| 30 |
# Launch the interface
|
| 31 |
+
interface.launch()
|