File size: 380 Bytes
98d3845
 
fc655be
98d3845
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
from transformers import BlipForQuestionAnswering
from transformers import AutoProcessor
from PIL import Image
import gradio as gr
def qna(image,question):
  inputs=processor(image,question,return_tensors="pt")
  out=model.generate(**inputs)
  return processor.decode(out[0],skip_special_tokens=True)
interf=gr.Interface(qna,inputs=["image","text"],outputs="text")
interf.launch()