File size: 843 Bytes
ad47766
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
from transformers import pipline

pipe = pipeline("image-to-text", model="Salesforce/blip2-opt-2.7b")



def answer_question(image, question):
    # Integrate your model logic here
    answer = "This is where the answer will appear."
    return answer

st.title("Image Question Answering")

# File uploader for the image
image = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])

# Text input for the question
question = st.text_input("Enter your question about the image:")

if st.button("Get Answer"):
    if image is not None and question:
        # Display the image
        st.image(image, use_column_width=True)
        # Get and display the answer
        answer = answer_question(image, question)
        st.write(answer)
    else:
        st.write("Please upload an image and enter a question.")