Spaces:
Runtime error
Runtime error
Commit
·
571a3f6
1
Parent(s):
3f280c5
Add image URL option to VQA
Browse files- apps/mlm.py +0 -1
- apps/vqa.py +13 -0
apps/mlm.py
CHANGED
|
@@ -90,7 +90,6 @@ def app(state):
|
|
| 90 |
if st.button("Use this URL"):
|
| 91 |
image_data = requests.get(query1, stream=True).raw
|
| 92 |
image = np.asarray(Image.open(image_data))
|
| 93 |
-
print(image.shape)
|
| 94 |
mlm_state.mlm_image = image
|
| 95 |
|
| 96 |
|
|
|
|
| 90 |
if st.button("Use this URL"):
|
| 91 |
image_data = requests.get(query1, stream=True).raw
|
| 92 |
image = np.asarray(Image.open(image_data))
|
|
|
|
| 93 |
mlm_state.mlm_image = image
|
| 94 |
|
| 95 |
|
apps/vqa.py
CHANGED
|
@@ -10,6 +10,8 @@ import streamlit as st
|
|
| 10 |
import numpy as np
|
| 11 |
import pandas as pd
|
| 12 |
import os
|
|
|
|
|
|
|
| 13 |
import matplotlib.pyplot as plt
|
| 14 |
import json
|
| 15 |
|
|
@@ -91,6 +93,17 @@ def app(state):
|
|
| 91 |
image = plt.imread(image_path)
|
| 92 |
vqa_state.vqa_image = image
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
transformed_image = get_transformed_image(vqa_state.vqa_image)
|
| 95 |
|
| 96 |
new_col1, new_col2 = st.beta_columns([5, 5])
|
|
|
|
| 10 |
import numpy as np
|
| 11 |
import pandas as pd
|
| 12 |
import os
|
| 13 |
+
import requests
|
| 14 |
+
from PIL import Image
|
| 15 |
import matplotlib.pyplot as plt
|
| 16 |
import json
|
| 17 |
|
|
|
|
| 93 |
image = plt.imread(image_path)
|
| 94 |
vqa_state.vqa_image = image
|
| 95 |
|
| 96 |
+
st.write("OR")
|
| 97 |
+
|
| 98 |
+
query1 = st.text_input(
|
| 99 |
+
"Enter a URL to an image",
|
| 100 |
+
value="http://images.cocodataset.org/val2017/000000039769.jpg",
|
| 101 |
+
)
|
| 102 |
+
if st.button("Use this URL"):
|
| 103 |
+
image_data = requests.get(query1, stream=True).raw
|
| 104 |
+
image = np.asarray(Image.open(image_data))
|
| 105 |
+
vqa_state.mlm_image = image
|
| 106 |
+
|
| 107 |
transformed_image = get_transformed_image(vqa_state.vqa_image)
|
| 108 |
|
| 109 |
new_col1, new_col2 = st.beta_columns([5, 5])
|