chun commited on
Commit
8127bb1
·
1 Parent(s): 087eb33

Upload 8 files

Browse files
Files changed (8) hide show
  1. app.py +28 -0
  2. flower.h5 +3 -0
  3. photo/a01.jpg +0 -0
  4. photo/a02.jpg +0 -0
  5. photo/a03.jpg +0 -0
  6. photo/a04.jpg +0 -0
  7. photo/a05.jpg +0 -0
  8. requirements.txt +90 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from keras.models import load_model
2
+ import numpy as np
3
+ from keras.preprocessing import image
4
+ import gradio as gr
5
+ from PIL import Image
6
+ model=load_model('./flower.h5')
7
+
8
+ def show(img):
9
+ img = img.reshape( 180, 180,3)
10
+ test_image=np.expand_dims(img, axis=0)
11
+ prediction=model.predict(test_image).tolist()[0]
12
+ class_names = ['daisy', 'dandelion', 'roses', 'sunflowers', 'tulips']
13
+ return {class_names[i]: prediction[i] for i in range(5)}
14
+
15
+ image = gr.inputs.Image(shape=(180,180))
16
+
17
+ demo = gr.Interface(
18
+ fn = show,
19
+ inputs = image,
20
+ examples=["photo/a01.jpg", "photo/a02.jpg","photo/a03.jpg","photo/a04.jpg","photo/a05.jpg"],
21
+ title="Flower Image Classification",
22
+ outputs = gr.outputs.Label(),
23
+
24
+ )
25
+
26
+
27
+ if __name__ == "__main__":
28
+ demo.launch()
flower.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae4d4db37a026d21874c6b813f696c229a88c03a9ba9a6a5fe7a87cc68ffb9c4
3
+ size 47925464
photo/a01.jpg ADDED
photo/a02.jpg ADDED
photo/a03.jpg ADDED
photo/a04.jpg ADDED
photo/a05.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==1.4.0
2
+ aiofiles==23.2.1
3
+ altair==5.1.1
4
+ annotated-types==0.5.0
5
+ anyio==3.7.1
6
+ astunparse==1.6.3
7
+ attrs==23.1.0
8
+ cachetools==5.3.1
9
+ certifi==2023.7.22
10
+ charset-normalizer==3.2.0
11
+ click==8.1.7
12
+ colorama==0.4.6
13
+ contourpy==1.1.1
14
+ cycler==0.11.0
15
+ exceptiongroup==1.1.3
16
+ fastapi==0.103.1
17
+ ffmpy==0.3.1
18
+ filelock==3.12.4
19
+ flatbuffers==23.5.26
20
+ fonttools==4.42.1
21
+ fsspec==2023.9.1
22
+ gast==0.4.0
23
+ google-auth==2.23.0
24
+ google-auth-oauthlib==1.0.0
25
+ google-pasta==0.2.0
26
+ gradio==3.44.3
27
+ gradio_client==0.5.0
28
+ grpcio==1.58.0
29
+ h11==0.14.0
30
+ h5py==3.9.0
31
+ httpcore==0.18.0
32
+ httpx==0.25.0
33
+ huggingface-hub==0.17.2
34
+ idna==3.4
35
+ importlib-metadata==6.8.0
36
+ importlib-resources==6.0.1
37
+ Jinja2==3.1.2
38
+ jsonschema==4.19.0
39
+ jsonschema-specifications==2023.7.1
40
+ keras==2.13.1
41
+ Keras-Preprocessing==1.1.2
42
+ kiwisolver==1.4.5
43
+ libclang==16.0.6
44
+ Markdown==3.4.4
45
+ MarkupSafe==2.1.3
46
+ matplotlib==3.8.0
47
+ numpy==1.24.3
48
+ oauthlib==3.2.2
49
+ opt-einsum==3.3.0
50
+ orjson==3.9.7
51
+ packaging==23.1
52
+ pandas==2.1.0
53
+ Pillow==10.0.1
54
+ protobuf==4.24.3
55
+ pyasn1==0.5.0
56
+ pyasn1-modules==0.3.0
57
+ pydantic==2.3.0
58
+ pydantic_core==2.6.3
59
+ pydub==0.25.1
60
+ pyparsing==3.1.1
61
+ python-dateutil==2.8.2
62
+ python-multipart==0.0.6
63
+ pytz==2023.3.post1
64
+ PyYAML==6.0.1
65
+ referencing==0.30.2
66
+ requests==2.31.0
67
+ requests-oauthlib==1.3.1
68
+ rpds-py==0.10.3
69
+ rsa==4.9
70
+ semantic-version==2.10.0
71
+ six==1.16.0
72
+ sniffio==1.3.0
73
+ starlette==0.27.0
74
+ tensorboard==2.13.0
75
+ tensorboard-data-server==0.7.1
76
+ tensorflow==2.13.0
77
+ tensorflow-estimator==2.13.0
78
+ tensorflow-intel==2.13.0
79
+ tensorflow-io-gcs-filesystem==0.31.0
80
+ termcolor==2.3.0
81
+ toolz==0.12.0
82
+ tqdm==4.66.1
83
+ typing_extensions==4.8.0
84
+ tzdata==2023.3
85
+ urllib3==1.26.16
86
+ uvicorn==0.23.2
87
+ websockets==11.0.3
88
+ Werkzeug==2.3.7
89
+ wrapt==1.15.0
90
+ zipp==3.17.0