Sandhya commited on
Commit
a7905c1
·
1 Parent(s): b1cd364

First Commit

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. app.py +25 -0
  3. pizza_steak.keras +3 -0
  4. requirements.txt +114 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.keras filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ from timeit import default_timer as timer
5
+ import matplotlib.pyplot as plt
6
+ from PIL import Image
7
+ model=tf.keras.models.load_model("pizza_steak.keras")
8
+ class_names=['Pizza','Steak']
9
+ def load_and_prep_image(img,img_shape=224):
10
+ if isinstance(img,Image.Image):
11
+ img=np.array(img)
12
+ img=tf.convert_to_tensor(img,dtype=tf.float32)
13
+ img=tf.image.resize(img,size=[img_shape,img_shape])
14
+ img=img/255
15
+ return img
16
+ def predict(img):
17
+ start_time=timer()
18
+ img=load_and_prep_image(img)
19
+ pred=model.predict(tf.expand_dims(img,axis=0))
20
+ pred_class=class_names[int(tf.round(pred)[0][0])]
21
+ pred_time=round(timer()-start_time,5)
22
+ return pred_class,pred_time
23
+
24
+ demo=gr.Interface(fn=predict,inputs=gr.Image(type="pil"),outputs=[gr.Label(num_top_classes=2),gr.Number(label="Prediction time")],title="Pizza vs Steak Classification")
25
+ demo.launch()
pizza_steak.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4e447ce9082bcac6fca3352143b987ab5fb491d329d997683e70c7cdd3d1322
3
+ size 162742
requirements.txt ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.2.2
2
+ aiofiles==24.1.0
3
+ annotated-types==0.7.0
4
+ anyio==4.9.0
5
+ asttokens==3.0.0
6
+ astunparse==1.6.3
7
+ certifi==2025.4.26
8
+ charset-normalizer==3.4.1
9
+ click==8.1.8
10
+ colorama==0.4.6
11
+ comm==0.2.2
12
+ contourpy==1.3.2
13
+ cycler==0.12.1
14
+ debugpy==1.8.14
15
+ decorator==5.2.1
16
+ executing==2.2.0
17
+ fastapi==0.115.12
18
+ ffmpy==0.5.0
19
+ filelock==3.18.0
20
+ flatbuffers==25.2.10
21
+ fonttools==4.57.0
22
+ fsspec==2025.3.2
23
+ gast==0.6.0
24
+ git-filter-repo==2.47.0
25
+ google-pasta==0.2.0
26
+ gradio==5.29.0
27
+ gradio_client==1.10.0
28
+ graphviz==0.20.3
29
+ groovy==0.1.2
30
+ grpcio==1.71.0
31
+ h11==0.16.0
32
+ h5py==3.13.0
33
+ httpcore==1.0.9
34
+ httpx==0.28.1
35
+ huggingface-hub==0.30.2
36
+ idna==3.10
37
+ ipykernel==6.29.5
38
+ ipython==9.2.0
39
+ ipython_pygments_lexers==1.1.1
40
+ jedi==0.19.2
41
+ Jinja2==3.1.6
42
+ joblib==1.4.2
43
+ jupyter_client==8.6.3
44
+ jupyter_core==5.7.2
45
+ keras==3.9.2
46
+ kiwisolver==1.4.8
47
+ libclang==18.1.1
48
+ Markdown==3.8
49
+ markdown-it-py==3.0.0
50
+ MarkupSafe==3.0.2
51
+ matplotlib==3.10.1
52
+ matplotlib-inline==0.1.7
53
+ mdurl==0.1.2
54
+ ml_dtypes==0.5.1
55
+ namex==0.0.9
56
+ nest-asyncio==1.6.0
57
+ numpy==2.1.3
58
+ opt_einsum==3.4.0
59
+ optree==0.15.0
60
+ orjson==3.10.18
61
+ packaging==25.0
62
+ pandas==2.2.3
63
+ parso==0.8.4
64
+ pillow==11.2.1
65
+ platformdirs==4.3.7
66
+ prompt_toolkit==3.0.51
67
+ protobuf==5.29.4
68
+ psutil==7.0.0
69
+ pure_eval==0.2.3
70
+ pydantic==2.11.4
71
+ pydantic_core==2.33.2
72
+ pydot==3.0.4
73
+ pydub==0.25.1
74
+ Pygments==2.19.1
75
+ pyparsing==3.2.3
76
+ python-dateutil==2.9.0.post0
77
+ python-multipart==0.0.20
78
+ pytz==2025.2
79
+ pywin32==310
80
+ PyYAML==6.0.2
81
+ pyzmq==26.4.0
82
+ requests==2.32.3
83
+ rich==14.0.0
84
+ ruff==0.11.8
85
+ safehttpx==0.1.6
86
+ scikit-learn==1.6.1
87
+ scipy==1.15.2
88
+ semantic-version==2.10.0
89
+ shellingham==1.5.4
90
+ six==1.17.0
91
+ sniffio==1.3.1
92
+ stack-data==0.6.3
93
+ starlette==0.46.2
94
+ tensorboard==2.19.0
95
+ tensorboard-data-server==0.7.2
96
+ tensorflow==2.19.0
97
+ tensorflow-io-gcs-filesystem==0.31.0
98
+ termcolor==3.0.1
99
+ threadpoolctl==3.6.0
100
+ tomlkit==0.13.2
101
+ tornado==6.4.2
102
+ tqdm==4.67.1
103
+ traitlets==5.14.3
104
+ typer==0.15.3
105
+ typing-inspection==0.4.0
106
+ typing_extensions==4.13.2
107
+ tzdata==2025.2
108
+ urllib3==2.4.0
109
+ uvicorn==0.34.2
110
+ wcwidth==0.2.13
111
+ websockets==15.0.1
112
+ Werkzeug==3.1.3
113
+ wget==3.2
114
+ wrapt==1.17.2