Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,6 +55,21 @@ demo = gr.Interface(
|
|
| 55 |
description="Pulls a random image from merve/coco and captions it using BLIP.",
|
| 56 |
)
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
demo.launch()
|
| 59 |
|
| 60 |
|
|
|
|
| 55 |
description="Pulls a random image from merve/coco and captions it using BLIP.",
|
| 56 |
)
|
| 57 |
|
| 58 |
+
|
| 59 |
+
# conditional image captioning
|
| 60 |
+
text = "a photography of"
|
| 61 |
+
inputs = processor(image, text, return_tensors="pt")
|
| 62 |
+
|
| 63 |
+
out = model.generate(**inputs)
|
| 64 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
| 65 |
+
|
| 66 |
+
# unconditional image captioning
|
| 67 |
+
inputs = processor(image, return_tensors="pt")
|
| 68 |
+
|
| 69 |
+
out = model.generate(**inputs)
|
| 70 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
| 71 |
+
|
| 72 |
+
|
| 73 |
demo.launch()
|
| 74 |
|
| 75 |
|