Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,3 +53,15 @@ image = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
|
|
| 53 |
|
| 54 |
# Text input for the question
|
| 55 |
question = st.text_input("Enter your question about the image:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# Text input for the question
|
| 55 |
question = st.text_input("Enter your question about the image:")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
if st.button("Get Answer"):
|
| 59 |
+
if image is not None and question:
|
| 60 |
+
# Display the image
|
| 61 |
+
st.image(image, use_column_width=True)
|
| 62 |
+
# Get and display the answer
|
| 63 |
+
model, processor = load_caption_model()
|
| 64 |
+
answer = answer_question(image, question, model, processor)
|
| 65 |
+
st.write(answer)
|
| 66 |
+
else:
|
| 67 |
+
st.write("Please upload an image and enter a question.")
|