Spaces:
Sleeping
Sleeping
Commit ·
1179283
1
Parent(s): 993300b
added stuff
Browse filesFiles changed (4)
- TomatoHealthy2.jpgAdded
- TomatoYellowCurlVirus3.jpgAdded
- gr.pyAdded+26
- requirements.txtAdded+99
1234567891011121314151617181920212223242526# %%import gradio as grimport tensorflow as tfimport numpy as npimport cv2# %%model_folder = 'plants_disease'with open(f'{model_folder}/labels.txt', 'r') as f: labels = f.read().split('\n')
# model = tf.saved_model.load(f'{model_folder}/last_layer.hdf5')model = tf.keras.models.load_model(f'{model_folder}/last_layer.hdf5')# %%def classify_image(model, inp): inp = cv2.resize(inp, (224,224,)) inp = inp.reshape((-1, 224, 224, 3)) inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp) prediction = model.predict(inp).flatten() print(prediction) confidences = {labels[i]: float(prediction[i]) for i in range(1000)} return confidences
gr.Interface(fn=classify_image, inputs=gr.Image(shape=(224, 224)), outputs=gr.Label(num_top_classes=3), examples=["TomatoHealthy2.jpg", "TomatoYellowCurlVirus3.jpg"]).launch()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899absl-py==1.4.0aiofiles==23.1.0aiohttp==3.8.4aiosignal==1.3.1altair==5.0.0anyio==3.6.2astunparse==1.6.3async-timeout==4.0.2attrs==23.1.0cachetools==5.3.0certifi==2023.5.7charset-normalizer==3.1.0click==8.1.3contourpy==1.0.7cycler==0.11.0fastapi==0.95.2ffmpy==0.3.0filelock==3.12.0flatbuffers==23.5.9fonttools==4.39.4frozenlist==1.3.3fsspec==2023.5.0gast==0.4.0google-auth==2.18.1google-auth-oauthlib==1.0.0google-pasta==0.2.0gradio==3.31.0gradio_client==0.2.5grpcio==1.54.2h11==0.14.0h5py==3.8.0httpcore==0.17.1httpx==0.24.1huggingface-hub==0.14.1idna==3.4importlib-metadata==6.6.0importlib-resources==5.12.0jax==0.4.10Jinja2==3.1.2jsonschema==4.17.3keras==2.12.0kiwisolver==1.4.4libclang==16.0.0linkify-it-py==2.0.2Markdown==3.4.3markdown-it-py==2.2.0MarkupSafe==2.1.2matplotlib==3.7.1mdit-py-plugins==0.3.3mdurl==0.1.2ml-dtypes==0.1.0multidict==6.0.4numpy==1.23.5oauthlib==3.2.2opencv-python==4.7.0.72opt-einsum==3.3.0orjson==3.8.12packaging==23.1pandas==2.0.1Pillow==9.5.0pkgutil_resolve_name==1.3.10protobuf==4.23.1pyasn1==0.5.0pyasn1-modules==0.3.0pydantic==1.10.7pydub==0.25.1Pygments==2.15.1pyparsing==3.0.9pyrsistent==0.19.3python-dateutil==2.8.2python-multipart==0.0.6pytz==2023.3PyYAML==6.0requests==2.30.0requests-oauthlib==1.3.1rsa==4.9scipy==1.10.1semantic-version==2.10.0six==1.16.0sniffio==1.3.0starlette==0.27.0tensorboard==2.12.3tensorboard-data-server==0.7.0tensorflow==2.12.0tensorflow-estimator==2.12.0tensorflow-io-gcs-filesystem==0.32.0termcolor==2.3.0toolz==0.12.0tqdm==4.65.0typing_extensions==4.5.0tzdata==2023.3uc-micro-py==1.0.2urllib3==1.26.15uvicorn==0.22.0websockets==11.0.3Werkzeug==2.3.4wrapt==1.14.1yarl==1.9.2zipp==3.15.0TomatoHealthy2.jpgAdded

TomatoYellowCurlVirus3.jpgAdded

gr.pyAdded+26
requirements.txtAdded+99