Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -140,15 +140,104 @@ def main():
|
|
| 140 |
with st.sidebar.expander("Advanced use"):
|
| 141 |
st.markdown(howto)
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
_, c, _ = st.columns((1, 3, 1))
|
| 144 |
if "query" in st.session_state:
|
| 145 |
query = c.text_input("", value=st.session_state["query"])
|
| 146 |
else:
|
| 147 |
-
|
| 148 |
-
# Unsplash images contain animals, apps, events, feelings, food, travel, nature, people, religion, sports, things, stock
|
| 149 |
-
# Unsplash things include flag, tree, clock, money, tattoo, arrow, book, car, fireworks, ghost, health, kiss, dance, balloon, crown, eye, house, music, airplane, lighthouse, typewriter, toys
|
| 150 |
-
# unsplash feelings include funny, heart, love, cool, congratulations, love, scary, cute, friendship, inspirational, hug, sad, cursed, beautiful, crazy, respect, transformation, peaceful, happy
|
| 151 |
-
# unsplash people contain baby, life, women, family, girls, pregnancy, society, old people, musician, attractive, bohemian
|
| 152 |
query = c.text_input("", value="health; artificial intelligence")
|
| 153 |
corpus = st.radio("", ["Unsplash", "Movies"])
|
| 154 |
if len(query) > 0:
|
|
|
|
| 140 |
with st.sidebar.expander("Advanced use"):
|
| 141 |
st.markdown(howto)
|
| 142 |
|
| 143 |
+
imagenet_templates = [
|
| 144 |
+
'a bad photo of a {}.',
|
| 145 |
+
'a photo of many {}.',
|
| 146 |
+
'a sculpture of a {}.',
|
| 147 |
+
'a photo of the hard to see {}.',
|
| 148 |
+
'a low resolution photo of the {}.',
|
| 149 |
+
'a rendering of a {}.',
|
| 150 |
+
'graffiti of a {}.',
|
| 151 |
+
'a bad photo of the {}.',
|
| 152 |
+
'a cropped photo of the {}.',
|
| 153 |
+
'a tattoo of a {}.',
|
| 154 |
+
'the embroidered {}.',
|
| 155 |
+
'a photo of a hard to see {}.',
|
| 156 |
+
'a bright photo of a {}.',
|
| 157 |
+
'a photo of a clean {}.',
|
| 158 |
+
'a photo of a dirty {}.',
|
| 159 |
+
'a dark photo of the {}.',
|
| 160 |
+
'a drawing of a {}.',
|
| 161 |
+
'a photo of my {}.',
|
| 162 |
+
'the plastic {}.',
|
| 163 |
+
'a photo of the cool {}.',
|
| 164 |
+
'a close-up photo of a {}.',
|
| 165 |
+
'a black and white photo of the {}.',
|
| 166 |
+
'a painting of the {}.',
|
| 167 |
+
'a painting of a {}.',
|
| 168 |
+
'a pixelated photo of the {}.',
|
| 169 |
+
'a sculpture of the {}.',
|
| 170 |
+
'a bright photo of the {}.',
|
| 171 |
+
'a cropped photo of a {}.',
|
| 172 |
+
'a plastic {}.',
|
| 173 |
+
'a photo of the dirty {}.',
|
| 174 |
+
'a jpeg corrupted photo of a {}.',
|
| 175 |
+
'a blurry photo of the {}.',
|
| 176 |
+
'a photo of the {}.',
|
| 177 |
+
'a good photo of the {}.',
|
| 178 |
+
'a rendering of the {}.',
|
| 179 |
+
'a {} in a video game.',
|
| 180 |
+
'a photo of one {}.',
|
| 181 |
+
'a doodle of a {}.',
|
| 182 |
+
'a close-up photo of the {}.',
|
| 183 |
+
'a photo of a {}.',
|
| 184 |
+
'the origami {}.',
|
| 185 |
+
'the {} in a video game.',
|
| 186 |
+
'a sketch of a {}.',
|
| 187 |
+
'a doodle of the {}.',
|
| 188 |
+
'a origami {}.',
|
| 189 |
+
'a low resolution photo of a {}.',
|
| 190 |
+
'the toy {}.',
|
| 191 |
+
'a rendition of the {}.',
|
| 192 |
+
'a photo of the clean {}.',
|
| 193 |
+
'a photo of a large {}.',
|
| 194 |
+
'a rendition of a {}.',
|
| 195 |
+
'a photo of a nice {}.',
|
| 196 |
+
'a photo of a weird {}.',
|
| 197 |
+
'a blurry photo of a {}.',
|
| 198 |
+
'a cartoon {}.',
|
| 199 |
+
'art of a {}.',
|
| 200 |
+
'a sketch of the {}.',
|
| 201 |
+
'a embroidered {}.',
|
| 202 |
+
'a pixelated photo of a {}.',
|
| 203 |
+
'itap of the {}.',
|
| 204 |
+
'a jpeg corrupted photo of the {}.',
|
| 205 |
+
'a good photo of a {}.',
|
| 206 |
+
'a plushie {}.',
|
| 207 |
+
'a photo of the nice {}.',
|
| 208 |
+
'a photo of the small {}.',
|
| 209 |
+
'a photo of the weird {}.',
|
| 210 |
+
'the cartoon {}.',
|
| 211 |
+
'art of the {}.',
|
| 212 |
+
'a drawing of the {}.',
|
| 213 |
+
'a photo of the large {}.',
|
| 214 |
+
'a black and white photo of a {}.',
|
| 215 |
+
'the plushie {}.',
|
| 216 |
+
'a dark photo of a {}.',
|
| 217 |
+
'itap of a {}.',
|
| 218 |
+
'graffiti of the {}.',
|
| 219 |
+
'a toy {}.',
|
| 220 |
+
'itap of my {}.',
|
| 221 |
+
'a photo of a cool {}.',
|
| 222 |
+
'a photo of a small {}.',
|
| 223 |
+
'a tattoo of the {}.',
|
| 224 |
+
]
|
| 225 |
+
|
| 226 |
+
st.sidebar.markdown(f"Unsplash has categories that match: backgrounds, photos, nature, iphone, etc")
|
| 227 |
+
st.sidebar.markdown(f"Unsplash images contain animals, apps, events, feelings, food, travel, nature, people, religion, sports, things, stock")
|
| 228 |
+
st.sidebar.markdown(f"Unsplash things include flag, tree, clock, money, tattoo, arrow, book, car, fireworks, ghost, health, kiss, dance, balloon, crown, eye, house, music, airplane, lighthouse, typewriter, toys")
|
| 229 |
+
st.sidebar.markdown(f"unsplash feelings include funny, heart, love, cool, congratulations, love, scary, cute, friendship, inspirational, hug, sad, cursed, beautiful, crazy, respect, transformation, peaceful, happy")
|
| 230 |
+
st.sidebar.markdown(f"unsplash people contain baby, life, women, family, girls, pregnancy, society, old people, musician, attractive, bohemian")
|
| 231 |
+
|
| 232 |
+
#print(f"{len(imagenet_classes)} classes, {len(imagenet_templates)} templates")
|
| 233 |
+
st.sidebar.markdown(f"{len(imagenet_classes)} classes, {len(imagenet_templates)} templates")
|
| 234 |
+
|
| 235 |
+
|
| 236 |
_, c, _ = st.columns((1, 3, 1))
|
| 237 |
if "query" in st.session_state:
|
| 238 |
query = c.text_input("", value=st.session_state["query"])
|
| 239 |
else:
|
| 240 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
query = c.text_input("", value="health; artificial intelligence")
|
| 242 |
corpus = st.radio("", ["Unsplash", "Movies"])
|
| 243 |
if len(query) > 0:
|