|
import streamlit as st |
|
from PIL import Image |
|
|
|
if 'has_run' not in st.session_state: |
|
st.session_state.has_run = False |
|
|
|
|
|
st.markdown('<h3><center><b>VQA</b></center></h3>', unsafe_allow_html=True) |
|
|
|
uploaded_image = st.sidebar.file_uploader("Upload your image here", type=["jpg", "jpeg", "png"]) |
|
|
|
if uploaded_image is not None: |
|
image = Image.open(uploaded_image) |
|
st.image(image, caption="Uploaded Image", use_column_width=True) |
|
|
|
task_prompt = st.sidebar.text_input("Task Prompt", value="Describe the image in detail:") |
|
|
|
text_input = st.sidebar.text_area("Input Questions", height=20) |
|
|
|
if st.sidebar.button("Generate Caption", key="Generate") and not st.session_state.has_run: |
|
|
|
st.session_state.has_run = True |
|
st.write(task_prompt,"\n\n",text_input) |
|
|
|
|
|
|