Spaces:
Sleeping
Sleeping
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.") | |