AmandaPanda commited on
Commit
56ce2bf
·
verified ·
1 Parent(s): fa9c320

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
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