|
import streamlit as st |
|
from transformers import pipline |
|
|
|
pipe = pipeline("image-to-text", model="Salesforce/blip2-opt-2.7b") |
|
|
|
|
|
|
|
def answer_question(image, question): |
|
|
|
answer = "This is where the answer will appear." |
|
return answer |
|
|
|
st.title("Image Question Answering") |
|
|
|
|
|
image = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"]) |
|
|
|
|
|
question = st.text_input("Enter your question about the image:") |
|
|
|
if st.button("Get Answer"): |
|
if image is not None and question: |
|
|
|
st.image(image, use_column_width=True) |
|
|
|
answer = answer_question(image, question) |
|
st.write(answer) |
|
else: |
|
st.write("Please upload an image and enter a question.") |
|
|