mrm8488 commited on
Commit
cf8abff
1 Parent(s): 8d07585

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -20,7 +20,7 @@ def predict(prompt, image_url, max_length):
20
  inputs = processor(prompts[0], return_tensors="pt").to(device)
21
  generated_ids = model.generate(**inputs, max_length=max_length)
22
  generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
23
- return generated_text
24
 
25
 
26
 
@@ -40,7 +40,10 @@ io = gr.Interface(fn=predict,
40
  gr.Textbox(label="image URL", placeholder="Insert the URL of the image to be described"),
41
  gr.Slider(label="Max tokens", value=64, max=128, min=16, step=8)
42
  ],
43
- outputs=gr.Textbox(label="IDEFICS Description"),
 
 
 
44
  title=title, description=description, examples=examples,
45
  allow_flagging=False, allow_screenshot=False)
46
  io.launch(debug=True)
 
20
  inputs = processor(prompts[0], return_tensors="pt").to(device)
21
  generated_ids = model.generate(**inputs, max_length=max_length)
22
  generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
23
+ return image, generated_text
24
 
25
 
26
 
 
40
  gr.Textbox(label="image URL", placeholder="Insert the URL of the image to be described"),
41
  gr.Slider(label="Max tokens", value=64, max=128, min=16, step=8)
42
  ],
43
+ outputs=[
44
+ gr.Image(type='pil'),
45
+ gr.Textbox(label="IDEFICS Description")
46
+ ],
47
  title=title, description=description, examples=examples,
48
  allow_flagging=False, allow_screenshot=False)
49
  io.launch(debug=True)