Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +1 -7
- requirements.txt +550 -0
- tags_extractor_demo.py +215 -0
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
title: ImageTagsExtractor
|
3 |
-
|
4 |
-
colorFrom: indigo
|
5 |
-
colorTo: yellow
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.6.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: ImageTagsExtractor
|
3 |
+
app_file: tags_extractor_demo.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 5.6.0
|
|
|
|
|
6 |
---
|
|
|
|
requirements.txt
ADDED
@@ -0,0 +1,550 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
dlib
|
2 |
+
absl-py==1.4.0
|
3 |
+
accelerate==1.1.1
|
4 |
+
aiofiles==23.2.1
|
5 |
+
aiohappyeyeballs==2.4.3
|
6 |
+
aiohttp==3.11.1
|
7 |
+
aiosignal==1.3.1
|
8 |
+
alabaster==1.0.0
|
9 |
+
albucore==0.0.19
|
10 |
+
albumentations==1.4.20
|
11 |
+
altair==4.2.2
|
12 |
+
annotated-types==0.7.0
|
13 |
+
anyio==3.7.1
|
14 |
+
argon2-cffi==23.1.0
|
15 |
+
argon2-cffi-bindings==21.2.0
|
16 |
+
array_record==0.5.1
|
17 |
+
arviz==0.20.0
|
18 |
+
astropy==6.1.6
|
19 |
+
astropy-iers-data==0.2024.11.11.0.32.38
|
20 |
+
astunparse==1.6.3
|
21 |
+
async-timeout==4.0.3
|
22 |
+
atpublic==4.1.0
|
23 |
+
attrs==24.2.0
|
24 |
+
audioread==3.0.1
|
25 |
+
autograd==1.7.0
|
26 |
+
babel==2.16.0
|
27 |
+
backcall==0.2.0
|
28 |
+
beautifulsoup4==4.12.3
|
29 |
+
bigframes==1.26.0
|
30 |
+
bigquery-magics==0.4.0
|
31 |
+
bleach==6.2.0
|
32 |
+
blinker==1.9.0
|
33 |
+
blis==0.7.11
|
34 |
+
blosc2==2.7.1
|
35 |
+
bokeh==3.6.1
|
36 |
+
Bottleneck==1.4.2
|
37 |
+
bqplot==0.12.43
|
38 |
+
branca==0.8.0
|
39 |
+
CacheControl==0.14.1
|
40 |
+
cachetools==5.5.0
|
41 |
+
catalogue==2.0.10
|
42 |
+
certifi==2024.8.30
|
43 |
+
cffi==1.17.1
|
44 |
+
chardet==5.2.0
|
45 |
+
charset-normalizer==3.4.0
|
46 |
+
chex==0.1.87
|
47 |
+
clarabel==0.9.0
|
48 |
+
click==8.1.7
|
49 |
+
cloudpathlib==0.20.0
|
50 |
+
cloudpickle==3.1.0
|
51 |
+
cmake==3.30.5
|
52 |
+
cmdstanpy==1.2.4
|
53 |
+
colorcet==3.1.0
|
54 |
+
colorlover==0.3.0
|
55 |
+
colour==0.1.5
|
56 |
+
community==1.0.0b1
|
57 |
+
confection==0.1.5
|
58 |
+
cons==0.4.6
|
59 |
+
contourpy==1.3.1
|
60 |
+
cryptography==43.0.3
|
61 |
+
cuda-python==12.2.1
|
62 |
+
cudf-cu12 @ https://pypi.nvidia.com/cudf-cu12/cudf_cu12-24.10.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
|
63 |
+
cufflinks==0.17.3
|
64 |
+
cupy-cuda12x==12.2.0
|
65 |
+
cvxopt==1.3.2
|
66 |
+
cvxpy==1.5.3
|
67 |
+
cycler==0.12.1
|
68 |
+
cymem==2.0.8
|
69 |
+
Cython==3.0.11
|
70 |
+
dask==2024.10.0
|
71 |
+
datascience==0.17.6
|
72 |
+
db-dtypes==1.3.1
|
73 |
+
dbus-python==1.2.18
|
74 |
+
debugpy==1.8.0
|
75 |
+
decorator==4.4.2
|
76 |
+
defusedxml==0.7.1
|
77 |
+
Deprecated==1.2.14
|
78 |
+
diffusers==0.31.0
|
79 |
+
distro==1.9.0
|
80 |
+
dm-tree==0.1.8
|
81 |
+
docker-pycreds==0.4.0
|
82 |
+
docstring_parser==0.16
|
83 |
+
docutils==0.21.2
|
84 |
+
dopamine_rl==4.0.9
|
85 |
+
duckdb==1.1.3
|
86 |
+
earthengine-api==1.2.0
|
87 |
+
easydict==1.13
|
88 |
+
ecos==2.0.14
|
89 |
+
editdistance==0.8.1
|
90 |
+
eerepr==0.0.4
|
91 |
+
einops==0.8.0
|
92 |
+
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl#sha256=86cc141f63942d4b2c5fcee06630fd6f904788d2f0ab005cce45aadb8fb73889
|
93 |
+
entrypoints==0.4
|
94 |
+
et_xmlfile==2.0.0
|
95 |
+
etils==1.10.0
|
96 |
+
etuples==0.3.9
|
97 |
+
eval_type_backport==0.2.0
|
98 |
+
exceptiongroup==1.2.2
|
99 |
+
fastai==2.7.18
|
100 |
+
fastapi==0.115.5
|
101 |
+
fastcore==1.7.19
|
102 |
+
fastdownload==0.0.7
|
103 |
+
fastjsonschema==2.20.0
|
104 |
+
fastprogress==1.0.3
|
105 |
+
fastrlock==0.8.2
|
106 |
+
ffmpy==0.4.0
|
107 |
+
filelock==3.16.1
|
108 |
+
firebase-admin==6.5.0
|
109 |
+
Flask==3.0.3
|
110 |
+
flatbuffers==24.3.25
|
111 |
+
flax==0.8.5
|
112 |
+
folium==0.18.0
|
113 |
+
fonttools==4.54.1
|
114 |
+
frozendict==2.4.6
|
115 |
+
frozenlist==1.5.0
|
116 |
+
fsspec==2024.10.0
|
117 |
+
future==1.0.0
|
118 |
+
gast==0.6.0
|
119 |
+
gcsfs==2024.10.0
|
120 |
+
gdown==5.2.0
|
121 |
+
geemap==0.35.1
|
122 |
+
gensim==4.3.3
|
123 |
+
geocoder==1.38.1
|
124 |
+
geographiclib==2.0
|
125 |
+
geopandas==1.0.1
|
126 |
+
geopy==2.4.1
|
127 |
+
gin-config==0.5.0
|
128 |
+
gitdb==4.0.11
|
129 |
+
GitPython==3.1.43
|
130 |
+
glob2==0.7
|
131 |
+
google==2.0.3
|
132 |
+
google-ai-generativelanguage==0.6.10
|
133 |
+
google-api-core==2.19.2
|
134 |
+
google-api-python-client==2.151.0
|
135 |
+
google-auth==2.27.0
|
136 |
+
google-auth-httplib2==0.2.0
|
137 |
+
google-auth-oauthlib==1.2.1
|
138 |
+
google-cloud-aiplatform==1.71.1
|
139 |
+
google-cloud-bigquery==3.25.0
|
140 |
+
google-cloud-bigquery-connection==1.16.1
|
141 |
+
google-cloud-bigquery-storage==2.27.0
|
142 |
+
google-cloud-bigtable==2.27.0
|
143 |
+
google-cloud-core==2.4.1
|
144 |
+
google-cloud-datastore==2.20.1
|
145 |
+
google-cloud-firestore==2.19.0
|
146 |
+
google-cloud-functions==1.18.0
|
147 |
+
google-cloud-iam==2.16.0
|
148 |
+
google-cloud-language==2.15.0
|
149 |
+
google-cloud-pubsub==2.27.1
|
150 |
+
google-cloud-resource-manager==1.13.0
|
151 |
+
google-cloud-storage==2.8.0
|
152 |
+
google-cloud-translate==3.17.0
|
153 |
+
google-crc32c==1.6.0
|
154 |
+
google-generativeai==0.8.3
|
155 |
+
google-pasta==0.2.0
|
156 |
+
google-resumable-media==2.7.2
|
157 |
+
googleapis-common-protos==1.66.0
|
158 |
+
googledrivedownloader==0.4
|
159 |
+
gradio==5.6.0
|
160 |
+
gradio_client==1.4.3
|
161 |
+
graphviz==0.20.3
|
162 |
+
greenlet==3.1.1
|
163 |
+
groq==0.12.0
|
164 |
+
grpc-google-iam-v1==0.13.1
|
165 |
+
grpcio==1.67.1
|
166 |
+
grpcio-status==1.62.3
|
167 |
+
gspread==6.0.2
|
168 |
+
gspread-dataframe==3.3.1
|
169 |
+
gym==0.25.2
|
170 |
+
gym-notices==0.0.8
|
171 |
+
h11==0.14.0
|
172 |
+
h5netcdf==1.4.1
|
173 |
+
h5py==3.12.1
|
174 |
+
holidays==0.60
|
175 |
+
holoviews==1.20.0
|
176 |
+
html5lib==1.1
|
177 |
+
httpcore==1.0.6
|
178 |
+
httpimport==1.4.0
|
179 |
+
httplib2==0.22.0
|
180 |
+
httpx==0.27.2
|
181 |
+
huggingface-hub==0.26.2
|
182 |
+
humanize==4.11.0
|
183 |
+
hyperopt==0.2.7
|
184 |
+
ibis-framework==9.2.0
|
185 |
+
idna==3.10
|
186 |
+
imageio==2.36.0
|
187 |
+
imageio-ffmpeg==0.5.1
|
188 |
+
imagesize==1.4.1
|
189 |
+
imbalanced-learn==0.12.4
|
190 |
+
imgaug==0.4.0
|
191 |
+
immutabledict==4.2.0
|
192 |
+
importlib_metadata==8.5.0
|
193 |
+
importlib_resources==6.4.5
|
194 |
+
imutils==0.5.4
|
195 |
+
inflect==7.4.0
|
196 |
+
iniconfig==2.0.0
|
197 |
+
intel-cmplr-lib-ur==2025.0.0
|
198 |
+
intel-openmp==2025.0.0
|
199 |
+
ipyevents==2.0.2
|
200 |
+
ipyfilechooser==0.6.0
|
201 |
+
ipykernel==5.5.6
|
202 |
+
ipyleaflet==0.19.2
|
203 |
+
ipyparallel==8.8.0
|
204 |
+
ipython==7.34.0
|
205 |
+
ipython-genutils==0.2.0
|
206 |
+
ipython-sql==0.5.0
|
207 |
+
ipytree==0.2.2
|
208 |
+
ipywidgets==7.7.1
|
209 |
+
itsdangerous==2.2.0
|
210 |
+
jax==0.4.33
|
211 |
+
jax-cuda12-pjrt==0.4.33
|
212 |
+
jax-cuda12-plugin==0.4.33
|
213 |
+
jaxlib==0.4.33
|
214 |
+
jeepney==0.7.1
|
215 |
+
jellyfish==1.1.0
|
216 |
+
jieba==0.42.1
|
217 |
+
Jinja2==3.1.4
|
218 |
+
jiter==0.7.1
|
219 |
+
joblib==1.4.2
|
220 |
+
jsonpatch==1.33
|
221 |
+
jsonpickle==4.0.0
|
222 |
+
jsonpointer==3.0.0
|
223 |
+
jsonschema==4.23.0
|
224 |
+
jsonschema-specifications==2024.10.1
|
225 |
+
jupyter-client==6.1.12
|
226 |
+
jupyter-console==6.1.0
|
227 |
+
jupyter-leaflet==0.19.2
|
228 |
+
jupyter-server==1.24.0
|
229 |
+
jupyter_core==5.7.2
|
230 |
+
jupyterlab_pygments==0.3.0
|
231 |
+
jupyterlab_widgets==3.0.13
|
232 |
+
kaggle==1.6.17
|
233 |
+
kagglehub==0.3.4
|
234 |
+
keras==3.5.0
|
235 |
+
keyring==23.5.0
|
236 |
+
kiwisolver==1.4.7
|
237 |
+
langchain==0.3.7
|
238 |
+
langchain-core==0.3.18
|
239 |
+
langchain-text-splitters==0.3.2
|
240 |
+
langcodes==3.4.1
|
241 |
+
langsmith==0.1.143
|
242 |
+
language_data==1.2.0
|
243 |
+
launchpadlib==1.10.16
|
244 |
+
lazr.restfulclient==0.14.4
|
245 |
+
lazr.uri==1.0.6
|
246 |
+
lazy_loader==0.4
|
247 |
+
libclang==18.1.1
|
248 |
+
libcudf-cu12 @ https://pypi.nvidia.com/libcudf-cu12/libcudf_cu12-24.10.1-py3-none-manylinux_2_28_x86_64.whl
|
249 |
+
librosa==0.10.2.post1
|
250 |
+
lightgbm==4.5.0
|
251 |
+
linkify-it-py==2.0.3
|
252 |
+
llvmlite==0.43.0
|
253 |
+
locket==1.0.0
|
254 |
+
logical-unification==0.4.6
|
255 |
+
lxml==5.3.0
|
256 |
+
marisa-trie==1.2.1
|
257 |
+
Markdown==3.7
|
258 |
+
markdown-it-py==3.0.0
|
259 |
+
MarkupSafe==2.1.5
|
260 |
+
matplotlib==3.8.0
|
261 |
+
matplotlib-inline==0.1.7
|
262 |
+
matplotlib-venn==1.1.1
|
263 |
+
mdit-py-plugins==0.4.2
|
264 |
+
mdurl==0.1.2
|
265 |
+
miniKanren==1.0.3
|
266 |
+
missingno==0.5.2
|
267 |
+
mistune==3.0.2
|
268 |
+
mizani==0.13.0
|
269 |
+
mkl==2025.0.0
|
270 |
+
ml-dtypes==0.4.1
|
271 |
+
mlxtend==0.23.2
|
272 |
+
more-itertools==10.5.0
|
273 |
+
moviepy==1.0.3
|
274 |
+
mpmath==1.3.0
|
275 |
+
msgpack==1.1.0
|
276 |
+
multidict==6.1.0
|
277 |
+
multipledispatch==1.0.0
|
278 |
+
multitasking==0.0.11
|
279 |
+
murmurhash==1.0.10
|
280 |
+
music21==9.3.0
|
281 |
+
namex==0.0.8
|
282 |
+
natsort==8.4.0
|
283 |
+
nbclassic==1.1.0
|
284 |
+
nbclient==0.10.0
|
285 |
+
nbconvert==7.16.4
|
286 |
+
nbformat==5.10.4
|
287 |
+
ndindex==1.9.2
|
288 |
+
nest-asyncio==1.6.0
|
289 |
+
networkx==3.4.2
|
290 |
+
nibabel==5.3.2
|
291 |
+
nltk==3.9.1
|
292 |
+
notebook==6.5.5
|
293 |
+
notebook_shim==0.2.4
|
294 |
+
numba==0.60.0
|
295 |
+
numexpr==2.10.1
|
296 |
+
numpy==1.26.4
|
297 |
+
nvidia-cublas-cu12==12.6.3.3
|
298 |
+
nvidia-cuda-cupti-cu12==12.6.80
|
299 |
+
nvidia-cuda-nvcc-cu12==12.6.77
|
300 |
+
nvidia-cuda-runtime-cu12==12.6.77
|
301 |
+
nvidia-cudnn-cu12==9.5.1.17
|
302 |
+
nvidia-cufft-cu12==11.3.0.4
|
303 |
+
nvidia-curand-cu12==10.3.7.77
|
304 |
+
nvidia-cusolver-cu12==11.7.1.2
|
305 |
+
nvidia-cusparse-cu12==12.5.4.2
|
306 |
+
nvidia-nccl-cu12==2.23.4
|
307 |
+
nvidia-nvjitlink-cu12==12.6.77
|
308 |
+
nvtx==0.2.10
|
309 |
+
nx-cugraph-cu12 @ https://pypi.nvidia.com/nx-cugraph-cu12/nx_cugraph_cu12-24.10.0-py3-none-any.whl
|
310 |
+
oauth2client==4.1.3
|
311 |
+
oauthlib==3.2.2
|
312 |
+
openai==1.54.4
|
313 |
+
opencv-contrib-python==4.10.0.84
|
314 |
+
opencv-python==4.10.0.84
|
315 |
+
opencv-python-headless==4.10.0.84
|
316 |
+
openpyxl==3.1.5
|
317 |
+
opentelemetry-api==1.28.1
|
318 |
+
opentelemetry-sdk==1.28.1
|
319 |
+
opentelemetry-semantic-conventions==0.49b1
|
320 |
+
opt_einsum==3.4.0
|
321 |
+
optax==0.2.4
|
322 |
+
optree==0.13.1
|
323 |
+
orbax-checkpoint==0.6.4
|
324 |
+
orjson==3.10.11
|
325 |
+
osqp==0.6.7.post3
|
326 |
+
packaging==24.2
|
327 |
+
pandas==2.2.2
|
328 |
+
pandas-datareader==0.10.0
|
329 |
+
pandas-gbq==0.24.0
|
330 |
+
pandas-stubs==2.2.2.240909
|
331 |
+
pandocfilters==1.5.1
|
332 |
+
panel==1.5.4
|
333 |
+
param==2.1.1
|
334 |
+
parso==0.8.4
|
335 |
+
parsy==2.1
|
336 |
+
partd==1.4.2
|
337 |
+
pathlib==1.0.1
|
338 |
+
patsy==1.0.1
|
339 |
+
peewee==3.17.8
|
340 |
+
peft==0.13.2
|
341 |
+
pexpect==4.9.0
|
342 |
+
pickleshare==0.7.5
|
343 |
+
pillow==11.0.0
|
344 |
+
platformdirs==4.3.6
|
345 |
+
plotly==5.24.1
|
346 |
+
plotnine==0.14.1
|
347 |
+
pluggy==1.5.0
|
348 |
+
polars==1.9.0
|
349 |
+
pooch==1.8.2
|
350 |
+
portpicker==1.5.2
|
351 |
+
preshed==3.0.9
|
352 |
+
prettytable==3.12.0
|
353 |
+
proglog==0.1.10
|
354 |
+
progressbar2==4.5.0
|
355 |
+
prometheus_client==0.21.0
|
356 |
+
promise==2.3
|
357 |
+
prompt_toolkit==3.0.48
|
358 |
+
propcache==0.2.0
|
359 |
+
prophet==1.1.6
|
360 |
+
proto-plus==1.25.0
|
361 |
+
protobuf==4.25.5
|
362 |
+
psutil==5.9.5
|
363 |
+
psycopg2==2.9.10
|
364 |
+
ptyprocess==0.7.0
|
365 |
+
py-cpuinfo==9.0.0
|
366 |
+
py4j==0.10.9.7
|
367 |
+
pyarrow==17.0.0
|
368 |
+
pyarrow-hotfix==0.6
|
369 |
+
pyasn1==0.6.1
|
370 |
+
pyasn1_modules==0.4.1
|
371 |
+
pycocotools==2.0.8
|
372 |
+
pycparser==2.22
|
373 |
+
pydantic==2.9.2
|
374 |
+
pydantic_core==2.23.4
|
375 |
+
pydata-google-auth==1.8.2
|
376 |
+
pydot==3.0.2
|
377 |
+
pydotplus==2.0.2
|
378 |
+
PyDrive==1.3.1
|
379 |
+
PyDrive2==1.21.1
|
380 |
+
pydub==0.25.1
|
381 |
+
pyerfa==2.0.1.5
|
382 |
+
pygame==2.6.1
|
383 |
+
pygit2==1.16.0
|
384 |
+
Pygments==2.18.0
|
385 |
+
PyGObject==3.42.1
|
386 |
+
PyJWT==2.9.0
|
387 |
+
pylibcudf-cu12 @ https://pypi.nvidia.com/pylibcudf-cu12/pylibcudf_cu12-24.10.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
|
388 |
+
pylibcugraph-cu12==24.10.0
|
389 |
+
pylibraft-cu12==24.10.0
|
390 |
+
pymc==5.18.0
|
391 |
+
pymystem3==0.2.0
|
392 |
+
pynvjitlink-cu12==0.4.0
|
393 |
+
pyogrio==0.10.0
|
394 |
+
PyOpenGL==3.1.7
|
395 |
+
pyOpenSSL==24.2.1
|
396 |
+
pyparsing==3.2.0
|
397 |
+
pyperclip==1.9.0
|
398 |
+
pyproj==3.7.0
|
399 |
+
pyshp==2.3.1
|
400 |
+
PySocks==1.7.1
|
401 |
+
pyspark==3.5.3
|
402 |
+
pytensor==2.25.5
|
403 |
+
pytest==8.3.3
|
404 |
+
python-apt==0.0.0
|
405 |
+
python-box==7.2.0
|
406 |
+
python-dateutil==2.8.2
|
407 |
+
python-louvain==0.16
|
408 |
+
python-multipart==0.0.12
|
409 |
+
python-slugify==8.0.4
|
410 |
+
python-utils==3.9.0
|
411 |
+
pytz==2024.2
|
412 |
+
pyviz_comms==3.0.3
|
413 |
+
PyYAML==6.0.2
|
414 |
+
pyzmq==24.0.1
|
415 |
+
qdldl==0.1.7.post4
|
416 |
+
ratelim==0.1.6
|
417 |
+
referencing==0.35.1
|
418 |
+
regex==2024.9.11
|
419 |
+
requests==2.32.3
|
420 |
+
requests-oauthlib==1.3.1
|
421 |
+
requests-toolbelt==1.0.0
|
422 |
+
requirements-parser==0.9.0
|
423 |
+
rich==13.9.4
|
424 |
+
rmm-cu12==24.10.0
|
425 |
+
rpds-py==0.21.0
|
426 |
+
rsa==4.9
|
427 |
+
ruff==0.7.4
|
428 |
+
safehttpx==0.1.1
|
429 |
+
safetensors==0.4.5
|
430 |
+
scikit-image==0.24.0
|
431 |
+
scikit-learn==1.5.2
|
432 |
+
scipy==1.13.1
|
433 |
+
scooby==0.10.0
|
434 |
+
scs==3.2.7
|
435 |
+
seaborn==0.13.2
|
436 |
+
SecretStorage==3.3.1
|
437 |
+
semantic-version==2.10.0
|
438 |
+
Send2Trash==1.8.3
|
439 |
+
sentence-transformers==3.2.1
|
440 |
+
sentencepiece==0.2.0
|
441 |
+
sentry-sdk==2.18.0
|
442 |
+
setproctitle==1.3.3
|
443 |
+
shap==0.46.0
|
444 |
+
shapely==2.0.6
|
445 |
+
shellingham==1.5.4
|
446 |
+
simple-parsing==0.1.6
|
447 |
+
six==1.16.0
|
448 |
+
sklearn-pandas==2.2.0
|
449 |
+
slicer==0.0.8
|
450 |
+
smart-open==7.0.5
|
451 |
+
smmap==5.0.1
|
452 |
+
sniffio==1.3.1
|
453 |
+
snowballstemmer==2.2.0
|
454 |
+
soundfile==0.12.1
|
455 |
+
soupsieve==2.6
|
456 |
+
soxr==0.5.0.post1
|
457 |
+
spacy==3.7.5
|
458 |
+
spacy-legacy==3.0.12
|
459 |
+
spacy-loggers==1.0.5
|
460 |
+
Sphinx==8.1.3
|
461 |
+
sphinxcontrib-applehelp==2.0.0
|
462 |
+
sphinxcontrib-devhelp==2.0.0
|
463 |
+
sphinxcontrib-htmlhelp==2.1.0
|
464 |
+
sphinxcontrib-jsmath==1.0.1
|
465 |
+
sphinxcontrib-qthelp==2.0.0
|
466 |
+
sphinxcontrib-serializinghtml==2.0.0
|
467 |
+
SQLAlchemy==2.0.36
|
468 |
+
sqlglot==25.1.0
|
469 |
+
sqlparse==0.5.2
|
470 |
+
srsly==2.4.8
|
471 |
+
stanio==0.5.1
|
472 |
+
starlette==0.41.3
|
473 |
+
statsmodels==0.14.4
|
474 |
+
StrEnum==0.4.15
|
475 |
+
stringzilla==3.10.10
|
476 |
+
sympy==1.13.1
|
477 |
+
tables==3.10.1
|
478 |
+
tabulate==0.9.0
|
479 |
+
tbb==2022.0.0
|
480 |
+
tcmlib==1.2.0
|
481 |
+
tenacity==9.0.0
|
482 |
+
tensorboard==2.17.1
|
483 |
+
tensorboard-data-server==0.7.2
|
484 |
+
tensorflow==2.17.1
|
485 |
+
tensorflow-datasets==4.9.7
|
486 |
+
tensorflow-hub==0.16.1
|
487 |
+
tensorflow-io-gcs-filesystem==0.37.1
|
488 |
+
tensorflow-metadata==1.13.1
|
489 |
+
tensorflow-probability==0.24.0
|
490 |
+
tensorstore==0.1.68
|
491 |
+
termcolor==2.5.0
|
492 |
+
terminado==0.18.1
|
493 |
+
text-unidecode==1.3
|
494 |
+
textblob==0.17.1
|
495 |
+
tf-slim==1.1.0
|
496 |
+
tf_keras==2.17.0
|
497 |
+
thinc==8.2.5
|
498 |
+
threadpoolctl==3.5.0
|
499 |
+
tifffile==2024.9.20
|
500 |
+
timm==1.0.11
|
501 |
+
tinycss2==1.4.0
|
502 |
+
tokenizers==0.20.3
|
503 |
+
toml==0.10.2
|
504 |
+
tomli==2.1.0
|
505 |
+
tomlkit==0.12.0
|
506 |
+
toolz==0.12.1
|
507 |
+
torch @ https://download.pytorch.org/whl/cu121_full/torch-2.5.1%2Bcu121-cp310-cp310-linux_x86_64.whl
|
508 |
+
torchaudio @ https://download.pytorch.org/whl/cu121/torchaudio-2.5.1%2Bcu121-cp310-cp310-linux_x86_64.whl
|
509 |
+
torchsummary==1.5.1
|
510 |
+
torchvision @ https://download.pytorch.org/whl/cu121/torchvision-0.20.1%2Bcu121-cp310-cp310-linux_x86_64.whl
|
511 |
+
tornado==6.3.3
|
512 |
+
tqdm==4.66.6
|
513 |
+
traitlets==5.7.1
|
514 |
+
traittypes==0.2.1
|
515 |
+
transformers==4.46.2
|
516 |
+
tweepy==4.14.0
|
517 |
+
typeguard==4.4.1
|
518 |
+
typer==0.13.0
|
519 |
+
types-pytz==2024.2.0.20241003
|
520 |
+
typing_extensions==4.12.2
|
521 |
+
tzdata==2024.2
|
522 |
+
tzlocal==5.2
|
523 |
+
uc-micro-py==1.0.3
|
524 |
+
umf==0.9.0
|
525 |
+
uritemplate==4.1.1
|
526 |
+
urllib3==2.2.3
|
527 |
+
uvicorn==0.32.0
|
528 |
+
vega-datasets==0.9.0
|
529 |
+
wadllib==1.3.6
|
530 |
+
wandb==0.18.7
|
531 |
+
wasabi==1.1.3
|
532 |
+
wcwidth==0.2.13
|
533 |
+
weasel==0.4.1
|
534 |
+
webcolors==24.11.1
|
535 |
+
webencodings==0.5.1
|
536 |
+
websocket-client==1.8.0
|
537 |
+
websockets==12.0
|
538 |
+
Werkzeug==3.1.3
|
539 |
+
widgetsnbextension==3.6.10
|
540 |
+
wordcloud==1.9.4
|
541 |
+
wrapt==1.16.0
|
542 |
+
xarray==2024.10.0
|
543 |
+
xarray-einstats==0.8.0
|
544 |
+
xgboost==2.1.2
|
545 |
+
xlrd==2.0.1
|
546 |
+
xyzservices==2024.9.0
|
547 |
+
yarl==1.17.1
|
548 |
+
yellowbrick==1.5
|
549 |
+
yfinance==0.2.49
|
550 |
+
zipp==3.21.0
|
tags_extractor_demo.py
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from PIL import Image
|
3 |
+
from transformers import BlipProcessor, BlipForConditionalGeneration
|
4 |
+
import torch
|
5 |
+
import math
|
6 |
+
import gradio as gr
|
7 |
+
|
8 |
+
import matplotlib.pyplot as plt
|
9 |
+
# %config InlineBackend.figure_format = 'retina'
|
10 |
+
|
11 |
+
import ipywidgets as widgets
|
12 |
+
from IPython.display import display, clear_output
|
13 |
+
|
14 |
+
from torch import nn
|
15 |
+
from torchvision.models import resnet50
|
16 |
+
import torchvision.transforms as T
|
17 |
+
from transformers import BlipProcessor, BlipForConditionalGeneration
|
18 |
+
from groq import Groq
|
19 |
+
import re
|
20 |
+
import json
|
21 |
+
|
22 |
+
GROQ_API_KEY = "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"
|
23 |
+
|
24 |
+
client = Groq(api_key = GROQ_API_KEY)
|
25 |
+
|
26 |
+
|
27 |
+
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
28 |
+
caption_model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
29 |
+
|
30 |
+
|
31 |
+
torch.set_grad_enabled(False);
|
32 |
+
|
33 |
+
# COCO classes
|
34 |
+
CLASSES = [
|
35 |
+
'N/A', 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus',
|
36 |
+
'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'N/A',
|
37 |
+
'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse',
|
38 |
+
'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'N/A', 'backpack',
|
39 |
+
'umbrella', 'N/A', 'N/A', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis',
|
40 |
+
'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove',
|
41 |
+
'skateboard', 'surfboard', 'tennis racket', 'bottle', 'N/A', 'wine glass',
|
42 |
+
'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich',
|
43 |
+
'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake',
|
44 |
+
'chair', 'couch', 'potted plant', 'bed', 'N/A', 'dining table', 'N/A',
|
45 |
+
'N/A', 'toilet', 'N/A', 'tv', 'laptop', 'mouse', 'remote', 'keyboard',
|
46 |
+
'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'N/A',
|
47 |
+
'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier',
|
48 |
+
'toothbrush'
|
49 |
+
]
|
50 |
+
|
51 |
+
# # colors for visualization
|
52 |
+
COLORS = [[0.000, 0.447, 0.741], [0.850, 0.325, 0.098], [0.929, 0.694, 0.125],
|
53 |
+
[0.494, 0.184, 0.556], [0.466, 0.674, 0.188], [0.301, 0.745, 0.933]]
|
54 |
+
|
55 |
+
# standard PyTorch mean-std input image normalization
|
56 |
+
transform = T.Compose([
|
57 |
+
T.Resize(800),
|
58 |
+
T.ToTensor(),
|
59 |
+
T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
|
60 |
+
])
|
61 |
+
|
62 |
+
# for output bounding box post-processing
|
63 |
+
def box_cxcywh_to_xyxy(x):
|
64 |
+
x_c, y_c, w, h = x.unbind(1)
|
65 |
+
b = [(x_c - 0.5 * w), (y_c - 0.5 * h),
|
66 |
+
(x_c + 0.5 * w), (y_c + 0.5 * h)]
|
67 |
+
return torch.stack(b, dim=1)
|
68 |
+
|
69 |
+
def rescale_bboxes(out_bbox, size):
|
70 |
+
img_w, img_h = size
|
71 |
+
b = box_cxcywh_to_xyxy(out_bbox)
|
72 |
+
b = b * torch.tensor([img_w, img_h, img_w, img_h], dtype=torch.float32)
|
73 |
+
return b
|
74 |
+
|
75 |
+
def plot_results(pil_img, prob, boxes):
|
76 |
+
plt.figure(figsize=(16,10))
|
77 |
+
plt.imshow(pil_img)
|
78 |
+
ax = plt.gca()
|
79 |
+
classes_predicted = []
|
80 |
+
colors = COLORS * 100
|
81 |
+
for p, (xmin, ymin, xmax, ymax), c in zip(prob, boxes.tolist(), colors):
|
82 |
+
ax.add_patch(plt.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin,
|
83 |
+
fill=False, color=c, linewidth=3))
|
84 |
+
cl = p.argmax()
|
85 |
+
text = f'{CLASSES[cl]}: {p[cl]:0.2f}'
|
86 |
+
(CLASSES[cl])
|
87 |
+
classes_predicted.append(CLASSES[cl])
|
88 |
+
ax.text(xmin, ymin, text, fontsize=15,
|
89 |
+
bbox=dict(facecolor='yellow', alpha=0.5))
|
90 |
+
plt.axis('off')
|
91 |
+
plt.show()
|
92 |
+
return list(set(classes_predicted))
|
93 |
+
|
94 |
+
model = torch.hub.load('facebookresearch/detr', 'detr_resnet50', pretrained=True)
|
95 |
+
model.eval();
|
96 |
+
|
97 |
+
|
98 |
+
def get_caption(img_url):
|
99 |
+
raw_image = Image.open(img_url).convert('RGB')
|
100 |
+
inputs = processor(raw_image, return_tensors="pt")
|
101 |
+
|
102 |
+
out = caption_model.generate(**inputs)
|
103 |
+
print(processor.decode(out[0], skip_special_tokens=True))
|
104 |
+
return str(processor.decode(out[0], skip_special_tokens=True))
|
105 |
+
|
106 |
+
|
107 |
+
def get_objects(url):
|
108 |
+
# url = '/content/saved_image.png'
|
109 |
+
im = Image.open(url)
|
110 |
+
|
111 |
+
# mean-std normalize the input image (batch-size: 1)
|
112 |
+
img = transform(im).unsqueeze(0)
|
113 |
+
|
114 |
+
# propagate through the model
|
115 |
+
outputs = model(img)
|
116 |
+
|
117 |
+
# keep only predictions with 0.7+ confidence
|
118 |
+
probas = outputs['pred_logits'].softmax(-1)[0, :, :-1]
|
119 |
+
keep = probas.max(-1).values > 0.9
|
120 |
+
|
121 |
+
# convert boxes from [0; 1] to image scales
|
122 |
+
bboxes_scaled = rescale_bboxes(outputs['pred_boxes'][0, keep], im.size)
|
123 |
+
|
124 |
+
res = plot_results(im, probas[keep], bboxes_scaled)
|
125 |
+
# print(res)
|
126 |
+
return res
|
127 |
+
|
128 |
+
|
129 |
+
system_prompt = """
|
130 |
+
<SystemPrompt>
|
131 |
+
Extract Tags from the provided text.
|
132 |
+
The Tags that will be used to search.
|
133 |
+
|
134 |
+
<OutputFormat>
|
135 |
+
Format the output in the following JSON structure
|
136 |
+
|
137 |
+
{
|
138 |
+
"tags" : [* list of tags here*]
|
139 |
+
}
|
140 |
+
|
141 |
+
</OutputFormat>
|
142 |
+
|
143 |
+
</SystemPrompt>
|
144 |
+
|
145 |
+
"""
|
146 |
+
def get_tags(text, objects):
|
147 |
+
try:
|
148 |
+
|
149 |
+
user_prompt = f"""
|
150 |
+
Extract the Tags from thei text:
|
151 |
+
|
152 |
+
{text}
|
153 |
+
|
154 |
+
{objects}
|
155 |
+
|
156 |
+
"""
|
157 |
+
|
158 |
+
chat_completion = client.chat.completions.create(
|
159 |
+
|
160 |
+
messages=[
|
161 |
+
{
|
162 |
+
"role": "system",
|
163 |
+
"content": system_prompt,
|
164 |
+
},
|
165 |
+
{
|
166 |
+
"role": "user",
|
167 |
+
"content": user_prompt,
|
168 |
+
}
|
169 |
+
],
|
170 |
+
model="llama3-8b-8192",
|
171 |
+
response_format={"type": "json_object"},
|
172 |
+
|
173 |
+
stream=False,
|
174 |
+
)
|
175 |
+
|
176 |
+
print(chat_completion)
|
177 |
+
|
178 |
+
json_data = json.loads(chat_completion.choices[0].message.content)
|
179 |
+
return json_data['tags'], chat_completion.usage.total_tokens * 0.00000005
|
180 |
+
|
181 |
+
except Exception as e:
|
182 |
+
print(f"Exception | get_tags | {str(e)}")
|
183 |
+
|
184 |
+
|
185 |
+
# Image processing function
|
186 |
+
def image_to_tags(image):
|
187 |
+
# tags = "shahzain, haider"
|
188 |
+
image = Image.fromarray(image)
|
189 |
+
image.save("saved_image.png")
|
190 |
+
|
191 |
+
generated_caption = get_caption('saved_image.png')
|
192 |
+
print(generated_caption)
|
193 |
+
|
194 |
+
objects = get_objects('saved_image.png')
|
195 |
+
|
196 |
+
tags, cost = get_tags(generated_caption, ", ".join(objects))
|
197 |
+
|
198 |
+
return ", ".join(tags) , generated_caption , ", ".join(objects), cost
|
199 |
+
# return "", "", ""
|
200 |
+
|
201 |
+
# Define Gradio interface
|
202 |
+
app = gr.Interface(
|
203 |
+
fn=image_to_tags,
|
204 |
+
inputs=gr.Image(type="numpy", label="Upload an Image"),
|
205 |
+
outputs=[
|
206 |
+
gr.Label(num_top_classes=5, label="Predicted Tags"),
|
207 |
+
gr.Textbox(label="Caption"),
|
208 |
+
gr.Textbox(label="Object Detection"),
|
209 |
+
gr.Textbox(label="Cost")
|
210 |
+
|
211 |
+
], title="Image Tagging App"
|
212 |
+
)
|
213 |
+
|
214 |
+
# Launch the app
|
215 |
+
app.launch(debug = True, share=True)
|