Spaces:
Runtime error
Runtime error
Commit
·
89ea6a7
1
Parent(s):
95fff6e
Fix layout
Browse files- apps/mlm.py +9 -8
- apps/vqa.py +7 -8
apps/mlm.py
CHANGED
|
@@ -67,7 +67,12 @@ def app(state):
|
|
| 67 |
with st.spinner("Loading model..."):
|
| 68 |
mlm_state.mlm_model = load_model(mlm_checkpoints[0])
|
| 69 |
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
if col1.button(
|
| 72 |
"Get a random example",
|
| 73 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
|
@@ -87,13 +92,9 @@ def app(state):
|
|
| 87 |
image = plt.imread(image_path)
|
| 88 |
mlm_state.mlm_image = image
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
"Enter a URL to an image",
|
| 94 |
-
value="http://images.cocodataset.org/val2017/000000039769.jpg",
|
| 95 |
-
)
|
| 96 |
-
if col2.button("Use above URL"):
|
| 97 |
image_data = requests.get(query1, stream=True).raw
|
| 98 |
image = np.asarray(Image.open(image_data))
|
| 99 |
mlm_state.mlm_image = image
|
|
|
|
| 67 |
with st.spinner("Loading model..."):
|
| 68 |
mlm_state.mlm_model = load_model(mlm_checkpoints[0])
|
| 69 |
|
| 70 |
+
query1 = st.text_input(
|
| 71 |
+
"Enter a URL to an image",
|
| 72 |
+
value="http://images.cocodataset.org/val2017/000000039769.jpg",
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
col1, col2, col3 = st.beta_columns([2,1, 2])
|
| 76 |
if col1.button(
|
| 77 |
"Get a random example",
|
| 78 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
|
|
|
| 92 |
image = plt.imread(image_path)
|
| 93 |
mlm_state.mlm_image = image
|
| 94 |
|
| 95 |
+
col2.write("OR")
|
| 96 |
+
|
| 97 |
+
if col3.button("Use above URL"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
image_data = requests.get(query1, stream=True).raw
|
| 99 |
image = np.asarray(Image.open(image_data))
|
| 100 |
mlm_state.mlm_image = image
|
apps/vqa.py
CHANGED
|
@@ -76,8 +76,11 @@ def app(state):
|
|
| 76 |
vqa_state.vqa_model = load_model(vqa_checkpoints[0])
|
| 77 |
|
| 78 |
# Display Top-5 Predictions
|
| 79 |
-
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
if col1.button(
|
| 82 |
"Get a random example",
|
| 83 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
|
@@ -93,13 +96,9 @@ def app(state):
|
|
| 93 |
image = plt.imread(image_path)
|
| 94 |
vqa_state.vqa_image = image
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
-
|
| 99 |
-
"Enter a URL to an image",
|
| 100 |
-
value="http://images.cocodataset.org/val2017/000000039769.jpg",
|
| 101 |
-
)
|
| 102 |
-
if col2.button("Use above URL"):
|
| 103 |
image_data = requests.get(query1, stream=True).raw
|
| 104 |
image = np.asarray(Image.open(image_data))
|
| 105 |
vqa_state.mlm_image = image
|
|
|
|
| 76 |
vqa_state.vqa_model = load_model(vqa_checkpoints[0])
|
| 77 |
|
| 78 |
# Display Top-5 Predictions
|
| 79 |
+
query1 = st.text_input(
|
| 80 |
+
"Enter a URL to an image",
|
| 81 |
+
value="http://images.cocodataset.org/val2017/000000039769.jpg",
|
| 82 |
+
)
|
| 83 |
+
col1, col2, col3 = st.beta_columns([2,1, 2])
|
| 84 |
if col1.button(
|
| 85 |
"Get a random example",
|
| 86 |
help="Get a random example from the 100 `seeded` image-text pairs.",
|
|
|
|
| 96 |
image = plt.imread(image_path)
|
| 97 |
vqa_state.vqa_image = image
|
| 98 |
|
| 99 |
+
col2.write("OR")
|
| 100 |
|
| 101 |
+
if col3.button("Use above URL"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
image_data = requests.get(query1, stream=True).raw
|
| 103 |
image = np.asarray(Image.open(image_data))
|
| 104 |
vqa_state.mlm_image = image
|