Update app.py
Browse files
app.py
CHANGED
|
@@ -2,8 +2,6 @@ import streamlit as st
|
|
| 2 |
from PIL import Image
|
| 3 |
import requests
|
| 4 |
from io import BytesIO
|
| 5 |
-
# Importing Hugging Face Spaces components
|
| 6 |
-
from huggingface_hub import hf_spaces
|
| 7 |
|
| 8 |
# Load the image question answering model
|
| 9 |
model_name = "deepset/roberta-base-squad2"
|
|
@@ -27,21 +25,21 @@ def main():
|
|
| 27 |
image = Image.open(uploaded_image)
|
| 28 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 29 |
|
| 30 |
-
# Ask question
|
| 31 |
-
question = st.text_input("Ask your question here:")
|
| 32 |
-
|
| 33 |
-
if st.button("Get Answer"):
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
|
| 46 |
if __name__ == "__main__":
|
| 47 |
main()
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
import requests
|
| 4 |
from io import BytesIO
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Load the image question answering model
|
| 7 |
model_name = "deepset/roberta-base-squad2"
|
|
|
|
| 25 |
image = Image.open(uploaded_image)
|
| 26 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
| 27 |
|
| 28 |
+
# # Ask question
|
| 29 |
+
# question = st.text_input("Ask your question here:")
|
| 30 |
+
|
| 31 |
+
# if st.button("Get Answer"):
|
| 32 |
+
# if question:
|
| 33 |
+
# # Convert image to bytes
|
| 34 |
+
# img_bytes = BytesIO()
|
| 35 |
+
# image.save(img_bytes, format='PNG')
|
| 36 |
+
# img_bytes = img_bytes.getvalue()
|
| 37 |
+
|
| 38 |
+
# # Perform image question answering
|
| 39 |
+
# answer = perform_image_qa(img_bytes, question)
|
| 40 |
+
# st.success("Answer: " + answer)
|
| 41 |
+
# else:
|
| 42 |
+
# st.warning("Please enter a question.")
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|
| 45 |
main()
|