Spaces:
Runtime error
Runtime error
File size: 884 Bytes
bbfb60a 4ddd43e bbfb60a 4ddd43e bbfb60a 4ddd43e bbfb60a 4ddd43e bbfb60a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # import gradio as gr
# from transformers import AutoProcessor
# from transformers import BlipForQuestionAnswering
# model = BlipForQuestionAnswering.from_pretrained("Salesforce/blip-vqa-base")
# processor = AutoProcessor.from_pretrained("Salesforce/blip-vqa-base")
# def process_image(image, question: str):
# inputs = processor(image, question, return_tensors="pt")
# output = model.generate(**inputs)
# answer = processor.decode(output[0], skip_special_tokens=True)
# return answer
# multimodal_visual_qa_interface = gr.Interface(
# fn=process_image,
# inputs=[
# gr.Image(label="Input Image", type="pil"),
# gr.Textbox(label="Enter question to prompt the image")
# ],
# outputs=gr.Textbox(label="Answer"),
# title="Multimodal Visual QA Application",
# description="This app can help you ask questions about an image"
# ) |