Spaces:
Runtime error
Runtime error
updated and imported model from hf hub
Browse files- app.py +3 -2
- requirements.txt +5 -98
app.py
CHANGED
|
@@ -4,11 +4,12 @@ from tensorflow import keras
|
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
| 6 |
import cv2
|
|
|
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
# Define your class names manually (if you know them)
|
| 12 |
class_names = ['Airplane', 'Car', 'Bird', 'Cat', 'Deer', 'Dog', 'Frog', 'Horse', 'Ship', 'Truck']
|
| 13 |
|
| 14 |
def predict_fn(img):
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import numpy as np
|
| 6 |
import cv2
|
| 7 |
+
from huggingface_hub import hf_hub_download
|
| 8 |
|
| 9 |
# Load the model
|
| 10 |
+
model_path = hf_hub_download(repo_id="jamesywu5/cifar10_model", filename="image_classifier.keras")
|
| 11 |
+
model = tf.keras.models.load_model(model_path)
|
| 12 |
|
|
|
|
| 13 |
class_names = ['Airplane', 'Car', 'Bird', 'Cat', 'Deer', 'Dog', 'Frog', 'Horse', 'Ship', 'Truck']
|
| 14 |
|
| 15 |
def predict_fn(img):
|
requirements.txt
CHANGED
|
@@ -1,99 +1,6 @@
|
|
| 1 |
-
absl-py==2.3.1
|
| 2 |
-
aiofiles==24.1.0
|
| 3 |
-
annotated-types==0.7.0
|
| 4 |
-
anyio==4.9.0
|
| 5 |
-
astunparse==1.6.3
|
| 6 |
-
Brotli==1.1.0
|
| 7 |
-
certifi==2025.7.14
|
| 8 |
-
charset-normalizer==3.4.2
|
| 9 |
-
click==8.2.1
|
| 10 |
-
cloudpickle==3.1.1
|
| 11 |
-
contourpy==1.3.2
|
| 12 |
-
cycler==0.12.1
|
| 13 |
-
fastapi==0.116.1
|
| 14 |
-
ffmpy==0.6.0
|
| 15 |
-
filelock==3.18.0
|
| 16 |
-
flatbuffers==25.2.10
|
| 17 |
-
fonttools==4.59.0
|
| 18 |
-
fsspec==2025.7.0
|
| 19 |
-
gast==0.4.0
|
| 20 |
-
google-pasta==0.2.0
|
| 21 |
-
gradio==5.37.0
|
| 22 |
-
gradio_client==1.10.4
|
| 23 |
-
groovy==0.1.2
|
| 24 |
-
grpcio==1.73.1
|
| 25 |
-
h11==0.16.0
|
| 26 |
-
h5py==3.14.0
|
| 27 |
-
hf-xet==1.1.5
|
| 28 |
-
httpcore==1.0.9
|
| 29 |
-
httpx==0.28.1
|
| 30 |
-
huggingface-hub==0.33.4
|
| 31 |
-
idna==3.10
|
| 32 |
-
imageio==2.37.0
|
| 33 |
-
Jinja2==3.1.6
|
| 34 |
-
joblib==1.5.1
|
| 35 |
-
keras==3.10.0
|
| 36 |
-
kiwisolver==1.4.8
|
| 37 |
-
lazy_loader==0.4
|
| 38 |
-
libclang==18.1.1
|
| 39 |
-
llvmlite==0.44.0
|
| 40 |
-
Markdown==3.8.2
|
| 41 |
-
markdown-it-py==3.0.0
|
| 42 |
-
MarkupSafe==3.0.2
|
| 43 |
-
matplotlib==3.10.3
|
| 44 |
-
mdurl==0.1.2
|
| 45 |
-
ml_dtypes==0.5.1
|
| 46 |
-
namex==0.1.0
|
| 47 |
-
networkx==3.4.2
|
| 48 |
-
numba==0.61.2
|
| 49 |
-
numpy==2.1.3
|
| 50 |
-
opencv-python-headless==4.12.0.88
|
| 51 |
-
opt_einsum==3.4.0
|
| 52 |
-
optree==0.16.0
|
| 53 |
-
orjson==3.11.0
|
| 54 |
-
packaging==25.0
|
| 55 |
-
pandas==2.3.1
|
| 56 |
-
pillow==11.3.0
|
| 57 |
-
protobuf==5.29.5
|
| 58 |
-
pydantic==2.11.7
|
| 59 |
-
pydantic_core==2.33.2
|
| 60 |
-
pydub==0.25.1
|
| 61 |
-
Pygments==2.19.2
|
| 62 |
-
pyparsing==3.2.3
|
| 63 |
-
python-dateutil==2.9.0.post0
|
| 64 |
-
python-multipart==0.0.20
|
| 65 |
-
pytz==2025.2
|
| 66 |
-
PyYAML==6.0.2
|
| 67 |
-
requests==2.32.4
|
| 68 |
-
rich==14.0.0
|
| 69 |
-
ruff==0.12.3
|
| 70 |
-
safehttpx==0.1.6
|
| 71 |
-
scikit-image==0.25.2
|
| 72 |
-
scikit-learn==1.7.0
|
| 73 |
-
scipy>=1.7.0,<1.13
|
| 74 |
-
semantic-version>=2.10.0
|
| 75 |
-
setuptools>=65.0.0
|
| 76 |
-
shap>=0.41.0,<0.49
|
| 77 |
-
shellingham>=1.3.0
|
| 78 |
-
six>=1.16.0
|
| 79 |
-
slicer>=0.0.7
|
| 80 |
-
sniffio>=1.3.0
|
| 81 |
-
starlette>=0.27.0
|
| 82 |
-
tensorboard>=2.10.0
|
| 83 |
-
tensorboard-data-server>=0.6.1
|
| 84 |
tensorflow==2.10.1
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
typer>=0.9.0
|
| 91 |
-
typing-inspection>=0.4.0
|
| 92 |
-
typing_extensions>=4.5.0
|
| 93 |
-
tzdata>=2022.1
|
| 94 |
-
urllib3>=1.26.0,<2.0
|
| 95 |
-
uvicorn>=0.20.0
|
| 96 |
-
websockets>=10.4
|
| 97 |
-
Werkzeug>=2.2.0
|
| 98 |
-
wheel>=0.38.0
|
| 99 |
-
wrapt>=1.14.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
tensorflow==2.10.1
|
| 2 |
+
gradio==5.37.0
|
| 3 |
+
numpy
|
| 4 |
+
opencv-python-headless
|
| 5 |
+
scipy
|
| 6 |
+
huggingface_hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|