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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -50,25 +50,12 @@ def caption_random_image():
50
  demo = gr.Interface(
51
  fn=caption_random_image,
52
  inputs=None,
53
- outputs=["image", "text"],
54
- title="Image Captioning",
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
 
 
50
  demo = gr.Interface(
51
  fn=caption_random_image,
52
  inputs=None,
53
+ outputs=[gr.Image(type="pil"), gr.Textbox(label="Caption")],
54
+ title="Random COCO Image Captioning",
55
+ description="Selects a random COCO image from 20 samples and generates a BLIP caption."
56
  )
57
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  demo.launch()
61