Spaces:
Runtime error
Runtime error
Vincent Claes
commited on
Commit
·
063c382
1
Parent(s):
c3ab558
add artist label
Browse files- app.py +25 -4
- mapping.json +0 -0
- poetry.lock +0 -0
- requirements.txt +15 -13
app.py
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
import os
|
2 |
import requests
|
|
|
3 |
|
4 |
import gradio as gr
|
5 |
|
|
|
|
|
|
|
6 |
|
7 |
def get_images(text):
|
8 |
headers = {
|
@@ -20,12 +24,15 @@ def get_images(text):
|
|
20 |
json={"data": text},
|
21 |
)
|
22 |
images = []
|
23 |
-
|
|
|
|
|
|
|
24 |
for image in image_data:
|
25 |
# got this from https://huggingface.co/spaces/stabilityai/stable-diffusion/blob/main/app.py
|
26 |
image_b64 = f"data:image/jpeg;base64,{image}"
|
27 |
images.append(image_b64)
|
28 |
-
return images
|
29 |
|
30 |
|
31 |
css = """
|
@@ -182,7 +189,7 @@ with block:
|
|
182 |
</div>
|
183 |
<p style="margin-bottom: 10px; font-size: 94%; line-height: 23px;">
|
184 |
Search the <a style="text-decoration: underline;" href="https://archive.org/details/wikiart-dataset">WikiArt dataset</a> containing 81 444 paintings.
|
185 |
-
</br>Read the article <a style="text-decoration: underline;" href="https://medium.com/@vincentclaes_43752/a110a2f5bf8e?source=friends_link&sk=cabf93a94d582ebbc53d3672cbb76a98">Searching Art
|
186 |
</p>
|
187 |
</div>
|
188 |
"""
|
@@ -225,8 +232,22 @@ with block:
|
|
225 |
gr.HTML(
|
226 |
"""
|
227 |
<div class="footer">
|
228 |
-
<p>Model by <a href="https://www.meet-drift.ai/" style="text-decoration: underline;" target="_blank">Drift</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
</p>
|
|
|
230 |
</div>
|
231 |
"""
|
232 |
)
|
|
|
1 |
import os
|
2 |
import requests
|
3 |
+
import json
|
4 |
|
5 |
import gradio as gr
|
6 |
|
7 |
+
with open("mapping.json", "r") as f:
|
8 |
+
mapping = json.load(f)
|
9 |
+
|
10 |
|
11 |
def get_images(text):
|
12 |
headers = {
|
|
|
24 |
json={"data": text},
|
25 |
)
|
26 |
images = []
|
27 |
+
response_json = response.json()
|
28 |
+
image_data = response_json["image"]
|
29 |
+
image_label = [f"Artist: {mapping[str(id_)]}" for id_ in response_json["id"]]
|
30 |
+
|
31 |
for image in image_data:
|
32 |
# got this from https://huggingface.co/spaces/stabilityai/stable-diffusion/blob/main/app.py
|
33 |
image_b64 = f"data:image/jpeg;base64,{image}"
|
34 |
images.append(image_b64)
|
35 |
+
return tuple(zip(images, image_label))
|
36 |
|
37 |
|
38 |
css = """
|
|
|
189 |
</div>
|
190 |
<p style="margin-bottom: 10px; font-size: 94%; line-height: 23px;">
|
191 |
Search the <a style="text-decoration: underline;" href="https://archive.org/details/wikiart-dataset">WikiArt dataset</a> containing 81 444 paintings.
|
192 |
+
</br>Read the article <a style="text-decoration: underline;" href="https://medium.com/@vincentclaes_43752/a110a2f5bf8e?source=friends_link&sk=cabf93a94d582ebbc53d3672cbb76a98">Searching Art with Artifical Intelligence</a>
|
193 |
</p>
|
194 |
</div>
|
195 |
"""
|
|
|
232 |
gr.HTML(
|
233 |
"""
|
234 |
<div class="footer">
|
235 |
+
<p>Model by <a href="https://www.meet-drift.ai/" style="text-decoration: underline;" target="_blank">Drift</a> </p>
|
236 |
+
</div>
|
237 |
+
</br>
|
238 |
+
<div style="text-align: center; margin: 0 auto;">
|
239 |
+
<p style="margin-bottom: 10px; font-size: 110%; line-height: 23px;">
|
240 |
+
Want a free demo on a sample of your image data?
|
241 |
+
</p>
|
242 |
+
<p style="margin-bottom: 10px; font-size: 94%; line-height: 23px;">
|
243 |
+
<a style="text-decoration: underline;" href="https://calendly.com/vincent-v-claes">Schedule a call</a> or contact me on <a style="text-decoration: underline;" href="https://www.linkedin.com/in/vincent-claes-0b346337">Linkedin</a>.
|
244 |
+
</p>
|
245 |
+
<p style="margin-bottom: 10px; font-size: 66%; line-height: 23px; text-align: left; margin-left: 225px">
|
246 |
+
> The images can be about anything! Art, animals, clothes,… </br>
|
247 |
+
> Low-resolution pictures are fine.</br>
|
248 |
+
> Watermarks on the pictures should be ok to validate the performance.</br>
|
249 |
</p>
|
250 |
+
|
251 |
</div>
|
252 |
"""
|
253 |
)
|
mapping.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
poetry.lock
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
requirements.txt
CHANGED
@@ -1,27 +1,28 @@
|
|
1 |
aiohttp==3.8.3
|
2 |
aiosignal==1.3.1
|
|
|
3 |
anyio==3.6.2
|
4 |
async-timeout==4.0.2
|
5 |
attrs==22.1.0
|
6 |
-
bcrypt==4.0.1
|
7 |
certifi==2022.12.7
|
8 |
-
cffi==1.15.1
|
9 |
charset-normalizer==2.1.1
|
10 |
click==8.1.3
|
11 |
contourpy==1.0.6
|
12 |
-
cryptography==38.0.4
|
13 |
cycler==0.11.0
|
|
|
14 |
fastapi==0.88.0
|
15 |
ffmpy==0.3.0
|
16 |
fonttools==4.38.0
|
17 |
frozenlist==1.3.3
|
18 |
fsspec==2022.11.0
|
19 |
-
gradio==3.
|
20 |
-
h11==0.
|
21 |
-
httpcore==0.
|
22 |
httpx==0.23.1
|
23 |
idna==3.4
|
|
|
24 |
Jinja2==3.1.2
|
|
|
25 |
kiwisolver==1.4.4
|
26 |
linkify-it-py==1.0.3
|
27 |
markdown-it-py==2.1.0
|
@@ -34,32 +35,33 @@ numpy==1.23.5
|
|
34 |
orjson==3.8.3
|
35 |
packaging==22.0
|
36 |
pandas==1.5.2
|
37 |
-
paramiko==2.12.0
|
38 |
Pillow==9.3.0
|
39 |
-
pip==22.3
|
40 |
-
|
41 |
pycryptodome==3.16.0
|
42 |
pydantic==1.10.2
|
43 |
pydub==0.25.1
|
44 |
-
PyNaCl==1.5.0
|
45 |
pyparsing==3.0.9
|
|
|
46 |
python-dateutil==2.8.2
|
47 |
python-dotenv==0.21.0
|
48 |
python-multipart==0.0.5
|
49 |
-
pytz==2022.
|
50 |
PyYAML==6.0
|
51 |
requests==2.28.1
|
52 |
rfc3986==1.5.0
|
53 |
setuptools==65.6.3
|
54 |
-
setuptools-scm==7.0
|
55 |
six==1.16.0
|
56 |
sniffio==1.3.0
|
57 |
starlette==0.22.0
|
58 |
tomli==2.0.1
|
|
|
59 |
typing_extensions==4.4.0
|
60 |
uc-micro-py==1.0.1
|
61 |
urllib3==1.26.13
|
62 |
uvicorn==0.20.0
|
63 |
websockets==10.4
|
64 |
-
wheel==0.
|
65 |
yarl==1.8.2
|
|
|
|
1 |
aiohttp==3.8.3
|
2 |
aiosignal==1.3.1
|
3 |
+
altair==4.2.0
|
4 |
anyio==3.6.2
|
5 |
async-timeout==4.0.2
|
6 |
attrs==22.1.0
|
|
|
7 |
certifi==2022.12.7
|
|
|
8 |
charset-normalizer==2.1.1
|
9 |
click==8.1.3
|
10 |
contourpy==1.0.6
|
|
|
11 |
cycler==0.11.0
|
12 |
+
entrypoints==0.4
|
13 |
fastapi==0.88.0
|
14 |
ffmpy==0.3.0
|
15 |
fonttools==4.38.0
|
16 |
frozenlist==1.3.3
|
17 |
fsspec==2022.11.0
|
18 |
+
gradio==3.14.0
|
19 |
+
h11==0.14.0
|
20 |
+
httpcore==0.16.2
|
21 |
httpx==0.23.1
|
22 |
idna==3.4
|
23 |
+
importlib-resources==5.10.1
|
24 |
Jinja2==3.1.2
|
25 |
+
jsonschema==4.17.3
|
26 |
kiwisolver==1.4.4
|
27 |
linkify-it-py==1.0.3
|
28 |
markdown-it-py==2.1.0
|
|
|
35 |
orjson==3.8.3
|
36 |
packaging==22.0
|
37 |
pandas==1.5.2
|
|
|
38 |
Pillow==9.3.0
|
39 |
+
pip==22.3
|
40 |
+
pkgutil_resolve_name==1.3.10
|
41 |
pycryptodome==3.16.0
|
42 |
pydantic==1.10.2
|
43 |
pydub==0.25.1
|
|
|
44 |
pyparsing==3.0.9
|
45 |
+
pyrsistent==0.19.2
|
46 |
python-dateutil==2.8.2
|
47 |
python-dotenv==0.21.0
|
48 |
python-multipart==0.0.5
|
49 |
+
pytz==2022.7
|
50 |
PyYAML==6.0
|
51 |
requests==2.28.1
|
52 |
rfc3986==1.5.0
|
53 |
setuptools==65.6.3
|
54 |
+
setuptools-scm==7.1.0
|
55 |
six==1.16.0
|
56 |
sniffio==1.3.0
|
57 |
starlette==0.22.0
|
58 |
tomli==2.0.1
|
59 |
+
toolz==0.12.0
|
60 |
typing_extensions==4.4.0
|
61 |
uc-micro-py==1.0.1
|
62 |
urllib3==1.26.13
|
63 |
uvicorn==0.20.0
|
64 |
websockets==10.4
|
65 |
+
wheel==0.37.1
|
66 |
yarl==1.8.2
|
67 |
+
zipp==3.11.0
|