Spaces:
Runtime error
Runtime error
sbY99
commited on
Commit
•
4d372d3
0
Parent(s):
init
Browse files- app.py +20 -0
- open_ai.yaml +125 -0
- requirements.txt +2 -0
- run.sh +1 -0
- simple_classifier.py +0 -0
- test.ipynb +25 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
from PIL import Image
|
4 |
+
|
5 |
+
pipeline = pipeline(task="image-classification", model="skyau/dog-breed-classifier-vit")
|
6 |
+
|
7 |
+
st.title("Dog Breed Classifier?")
|
8 |
+
|
9 |
+
file_name = st.file_uploader("Upload a dog image")
|
10 |
+
|
11 |
+
if file_name is not None:
|
12 |
+
col1, col2 = st.columns(2)
|
13 |
+
|
14 |
+
image = Image.open(file_name)
|
15 |
+
col1.image(image, use_column_width=True)
|
16 |
+
predictions = pipeline(image)
|
17 |
+
|
18 |
+
col2.header("Probabilities")
|
19 |
+
for p in predictions:
|
20 |
+
col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
open_ai.yaml
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: open_ai
|
2 |
+
channels:
|
3 |
+
- conda-forge
|
4 |
+
- defaults
|
5 |
+
dependencies:
|
6 |
+
- _libgcc_mutex=0.1=main
|
7 |
+
- _openmp_mutex=5.1=1_gnu
|
8 |
+
- asttokens=2.2.1=pyhd8ed1ab_0
|
9 |
+
- backcall=0.2.0=pyh9f0ad1d_0
|
10 |
+
- backports=1.0=pyhd8ed1ab_3
|
11 |
+
- backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
|
12 |
+
- ca-certificates=2022.12.7=ha878542_0
|
13 |
+
- certifi=2022.12.7=pyhd8ed1ab_0
|
14 |
+
- decorator=5.1.1=pyhd8ed1ab_0
|
15 |
+
- entrypoints=0.4=pyhd8ed1ab_0
|
16 |
+
- executing=1.2.0=pyhd8ed1ab_0
|
17 |
+
- jedi=0.18.2=pyhd8ed1ab_0
|
18 |
+
- jupyter_client=7.0.6=pyhd8ed1ab_0
|
19 |
+
- jupyter_core=5.2.0=py38h578d9bd_0
|
20 |
+
- ld_impl_linux-64=2.38=h1181459_1
|
21 |
+
- libffi=3.4.2=h6a678d5_6
|
22 |
+
- libgcc-ng=11.2.0=h1234567_1
|
23 |
+
- libgomp=11.2.0=h1234567_1
|
24 |
+
- libsodium=1.0.18=h36c2ea0_1
|
25 |
+
- libstdcxx-ng=11.2.0=h1234567_1
|
26 |
+
- matplotlib-inline=0.1.6=pyhd8ed1ab_0
|
27 |
+
- ncurses=6.4=h6a678d5_0
|
28 |
+
- nest-asyncio=1.5.6=pyhd8ed1ab_0
|
29 |
+
- openssl=1.1.1s=h7f8727e_0
|
30 |
+
- packaging=23.0=pyhd8ed1ab_0
|
31 |
+
- parso=0.8.3=pyhd8ed1ab_0
|
32 |
+
- pexpect=4.8.0=pyh1a96a4e_2
|
33 |
+
- pickleshare=0.7.5=py_1003
|
34 |
+
- pip=22.3.1=py38h06a4308_0
|
35 |
+
- prompt-toolkit=3.0.36=pyha770c72_0
|
36 |
+
- ptyprocess=0.7.0=pyhd3deb0d_0
|
37 |
+
- pure_eval=0.2.2=pyhd8ed1ab_0
|
38 |
+
- pygments=2.14.0=pyhd8ed1ab_0
|
39 |
+
- python=3.8.16=h7a1cb2a_2
|
40 |
+
- python-dateutil=2.8.2=pyhd8ed1ab_0
|
41 |
+
- python_abi=3.8=2_cp38
|
42 |
+
- readline=8.2=h5eee18b_0
|
43 |
+
- setuptools=65.6.3=py38h06a4308_0
|
44 |
+
- six=1.16.0=pyh6c4a22f_0
|
45 |
+
- sqlite=3.40.1=h5082296_0
|
46 |
+
- stack_data=0.6.2=pyhd8ed1ab_0
|
47 |
+
- tk=8.6.12=h1ccaba5_0
|
48 |
+
- traitlets=5.9.0=pyhd8ed1ab_0
|
49 |
+
- typing-extensions=4.4.0=hd8ed1ab_0
|
50 |
+
- typing_extensions=4.4.0=pyha770c72_0
|
51 |
+
- wcwidth=0.2.6=pyhd8ed1ab_0
|
52 |
+
- wheel=0.37.1=pyhd3eb1b0_0
|
53 |
+
- xz=5.2.10=h5eee18b_1
|
54 |
+
- zeromq=4.3.4=h9c3ff4c_1
|
55 |
+
- zlib=1.2.13=h5eee18b_0
|
56 |
+
- pip:
|
57 |
+
- aiohttp==3.8.3
|
58 |
+
- aiosignal==1.3.1
|
59 |
+
- altair==4.2.2
|
60 |
+
- async-timeout==4.0.2
|
61 |
+
- attrs==22.2.0
|
62 |
+
- backports-zoneinfo==0.2.1
|
63 |
+
- blinker==1.5
|
64 |
+
- cachetools==4.2.4
|
65 |
+
- charset-normalizer==2.1.1
|
66 |
+
- click==8.1.3
|
67 |
+
- comm==0.1.2
|
68 |
+
- debugpy==1.6.6
|
69 |
+
- frozenlist==1.3.3
|
70 |
+
- gitdb==4.0.10
|
71 |
+
- gitpython==3.1.30
|
72 |
+
- google-api-core==1.34.0
|
73 |
+
- google-auth==1.35.0
|
74 |
+
- google-cloud-core==1.7.3
|
75 |
+
- google-cloud-translate==2.0.1
|
76 |
+
- googleapis-common-protos==1.58.0
|
77 |
+
- grpcio==1.51.1
|
78 |
+
- grpcio-status==1.48.2
|
79 |
+
- idna==3.4
|
80 |
+
- importlib-metadata==6.0.0
|
81 |
+
- importlib-resources==5.10.2
|
82 |
+
- ipykernel==6.21.1
|
83 |
+
- ipython==8.9.0
|
84 |
+
- jinja2==3.1.2
|
85 |
+
- jsonschema==4.17.3
|
86 |
+
- jupyter-client==8.0.2
|
87 |
+
- markdown-it-py==2.1.0
|
88 |
+
- markupsafe==2.1.2
|
89 |
+
- mdurl==0.1.2
|
90 |
+
- multidict==6.0.4
|
91 |
+
- numpy==1.24.2
|
92 |
+
- openai==0.27.0
|
93 |
+
- pandas==1.5.3
|
94 |
+
- pillow==9.4.0
|
95 |
+
- pkgutil-resolve-name==1.3.10
|
96 |
+
- platformdirs==2.6.2
|
97 |
+
- protobuf==3.20.3
|
98 |
+
- psutil==5.9.4
|
99 |
+
- pyarrow==11.0.0
|
100 |
+
- pyasn1==0.4.8
|
101 |
+
- pyasn1-modules==0.2.8
|
102 |
+
- pydeck==0.8.0
|
103 |
+
- pympler==1.0.1
|
104 |
+
- pyrsistent==0.19.3
|
105 |
+
- python-dotenv==0.21.1
|
106 |
+
- pytz==2022.7.1
|
107 |
+
- pytz-deprecation-shim==0.1.0.post0
|
108 |
+
- pyzmq==25.0.0
|
109 |
+
- requests==2.28.2
|
110 |
+
- rich==13.3.1
|
111 |
+
- rsa==4.9
|
112 |
+
- semver==2.13.0
|
113 |
+
- smmap==5.0.0
|
114 |
+
- streamlit==1.17.0
|
115 |
+
- toml==0.10.2
|
116 |
+
- toolz==0.12.0
|
117 |
+
- tornado==6.2
|
118 |
+
- tqdm==4.64.1
|
119 |
+
- tzdata==2022.7
|
120 |
+
- tzlocal==4.2
|
121 |
+
- urllib3==1.26.14
|
122 |
+
- validators==0.20.0
|
123 |
+
- watchdog==2.2.1
|
124 |
+
- yarl==1.8.2
|
125 |
+
- zipp==3.12.1
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
run.sh
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
streamlit run app.py
|
simple_classifier.py
ADDED
File without changes
|
test.ipynb
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {
|
4 |
+
"kernelspec": {
|
5 |
+
"display_name": "open_ai",
|
6 |
+
"language": "python",
|
7 |
+
"name": "python3"
|
8 |
+
},
|
9 |
+
"language_info": {
|
10 |
+
"codemirror_mode": {
|
11 |
+
"name": "ipython",
|
12 |
+
"version": 3
|
13 |
+
},
|
14 |
+
"file_extension": ".py",
|
15 |
+
"mimetype": "text/x-python",
|
16 |
+
"name": "python",
|
17 |
+
"nbconvert_exporter": "python",
|
18 |
+
"pygments_lexer": "ipython3",
|
19 |
+
"version": "3.8.16"
|
20 |
+
},
|
21 |
+
"orig_nbformat": 4
|
22 |
+
},
|
23 |
+
"nbformat": 4,
|
24 |
+
"nbformat_minor": 2
|
25 |
+
}
|