ybelkada commited on
Commit
88f422e
1 Parent(s): 603d833

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -21,6 +21,6 @@ def inference(text, image):
21
  prompt = prompt_format.format(text)
22
  inputs = processor(prompt, image, return_tensors='pt').to(0, torch.float16)
23
  output = model.generate(**inputs, max_new_tokens=1024)
24
- return processor.decode(output[0][2:], skip_special_tokens=True)
25
 
26
  gr.Interface(fn=inference, inputs=[gr.Text(), gr.Image()], outputs=gr.Text()).launch()
 
21
  prompt = prompt_format.format(text)
22
  inputs = processor(prompt, image, return_tensors='pt').to(0, torch.float16)
23
  output = model.generate(**inputs, max_new_tokens=1024)
24
+ return processor.decode(output[0], skip_special_tokens=True).split("ASSISTANT:")[-1]
25
 
26
  gr.Interface(fn=inference, inputs=[gr.Text(), gr.Image()], outputs=gr.Text()).launch()