Vincent Claes commited on
Commit
57d0ffa
โ€ข
1 Parent(s): b83129e

initial code generated by chatgpt

Browse files
Files changed (6) hide show
  1. Makefile +4 -0
  2. README.md +9 -3
  3. app.py +24 -0
  4. poetry.lock +0 -0
  5. pyproject.toml +16 -0
  6. requirements.txt +64 -0
Makefile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ install:
2
+ poetry install
3
+ poetry run pip list --format=freeze > requirements.txt
4
+
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: Art Search Engine
3
- emoji: ๐Ÿ“‰
4
- colorFrom: red
5
- colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.12.0
8
  app_file: app.py
@@ -10,3 +10,9 @@ pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
  ---
2
  title: Art Search Engine
3
+ emoji: ๐Ÿ–ผ๐Ÿ–ผ๐Ÿ–ผ
4
+ colorFrom: black
5
+ colorTo: black
6
  sdk: gradio
7
  sdk_version: 3.12.0
8
  app_file: app.py
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
+
15
+ ```bash
16
+ make setup
17
+ poetry shell
18
+ ```
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import requests
3
+ import base64
4
+ from PIL import Image
5
+
6
+ # define the function that will be called when the user inputs text
7
+ def get_images(text):
8
+ # send the text to the REST API using a POST request
9
+ response = requests.post("https://example.com/api/images", json={"text": text})
10
+ # get the list of image data from the response
11
+ image_data = response.json()["images"]
12
+ # decode the base64-encoded image data and convert it to PIL images
13
+ images = [Image.open(base64.decodebytes(data)) for data in image_data]
14
+ # return the list of images
15
+ return images
16
+
17
+ # create the gradio app, passing the function as the input and output
18
+ app = gr.Interface(get_images,
19
+ gr.components.Textbox(label="Description"),
20
+ gr.components.Image(label="Images", type="pil")
21
+ )
22
+
23
+ # start the app
24
+ app.launch()
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "art-search-engine"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Vincent Claes <vincent.v.claes@gmail.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.8"
10
+ gradio = "^3.12.0"
11
+ Pillow = "^9.3.0"
12
+
13
+
14
+ [build-system]
15
+ requires = ["poetry-core"]
16
+ build-backend = "poetry.core.masonry.api"
requirements.txt ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.12.0
20
+ h11==0.12.0
21
+ httpcore==0.15.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
28
+ MarkupSafe==2.1.1
29
+ matplotlib==3.6.2
30
+ mdit-py-plugins==0.3.3
31
+ mdurl==0.1.2
32
+ multidict==6.0.3
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
+ pycparser==2.21
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-multipart==0.0.5
48
+ pytz==2022.6
49
+ PyYAML==6.0
50
+ requests==2.28.1
51
+ rfc3986==1.5.0
52
+ setuptools==65.6.3
53
+ setuptools-scm==7.0.5
54
+ six==1.16.0
55
+ sniffio==1.3.0
56
+ starlette==0.22.0
57
+ tomli==2.0.1
58
+ typing_extensions==4.4.0
59
+ uc-micro-py==1.0.1
60
+ urllib3==1.26.13
61
+ uvicorn==0.20.0
62
+ websockets==10.4
63
+ wheel==0.37.1
64
+ yarl==1.8.2