Spaces:
Running
Running
Fix Unsplash bug and improve docs
Browse files- examples.py +5 -2
- text2image.py +6 -3
examples.py
CHANGED
@@ -13,14 +13,17 @@ def app():
|
|
13 |
OpenAI's CLIP, our training choices and quality datasets led to impressive results!
|
14 |
Here, we collected few of **the most impressive text-image associations** learned by our model.
|
15 |
|
16 |
-
Remember you can head
|
17 |
-
your own π€ Italian π€ queries!
|
18 |
|
19 |
"""
|
20 |
)
|
21 |
|
22 |
st.markdown("### 1. Actors in Scenes")
|
23 |
|
|
|
|
|
|
|
|
|
24 |
col1, col2 = st.beta_columns(2)
|
25 |
col1.subheader("una coppia con il tramonto sullo sfondo")
|
26 |
col1.markdown("*a couple with the sunset in the background*")
|
|
|
13 |
OpenAI's CLIP, our training choices and quality datasets led to impressive results!
|
14 |
Here, we collected few of **the most impressive text-image associations** learned by our model.
|
15 |
|
16 |
+
Remember you can head to the **Text to Image** section of the demo at any time to test your own π€ Italian π€ queries!
|
|
|
17 |
|
18 |
"""
|
19 |
)
|
20 |
|
21 |
st.markdown("### 1. Actors in Scenes")
|
22 |
|
23 |
+
st.subheader("una coppia")
|
24 |
+
st.markdown("*a couple*")
|
25 |
+
st.image("static/img/examples/couple_0.jpeg")
|
26 |
+
|
27 |
col1, col2 = st.beta_columns(2)
|
28 |
col1.subheader("una coppia con il tramonto sullo sfondo")
|
29 |
col1.markdown("*a couple with the sunset in the background*")
|
text2image.py
CHANGED
@@ -184,9 +184,12 @@ def app():
|
|
184 |
|
185 |
for i, image_url in enumerate(image_paths):
|
186 |
try:
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
190 |
break
|
191 |
except (UnidentifiedImageError) as e:
|
192 |
if i == N - 1:
|
|
|
184 |
|
185 |
for i, image_url in enumerate(image_paths):
|
186 |
try:
|
187 |
+
if dataset_name == "Unsplash":
|
188 |
+
st.image(image_url)
|
189 |
+
elif dataset_name == "CC":
|
190 |
+
image_raw = requests.get(image_url, stream=True, allow_redirects=True, headers=headers).raw
|
191 |
+
image = Image.open(image_raw).convert("RGB")
|
192 |
+
st.image(image)
|
193 |
break
|
194 |
except (UnidentifiedImageError) as e:
|
195 |
if i == N - 1:
|