Image Classification
Keras
LiteRT
English
computer-vision
satellite-imagery
tensorflow
remote-sensing
land-cover-classification
Instructions to use Mirutex/Celyrix-1.0-Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Mirutex/Celyrix-1.0-Vision with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Mirutex/Celyrix-1.0-Vision") - Notebooks
- Google Colab
- Kaggle
Download app/app.py from Mirutex/Celyrix-1.0-Vision: direct link, hf CLI and curl.
- Browser
- Download file 3.09 kB
-
https://huggingface.co/Mirutex/Celyrix-1.0-Vision/resolve/main/app/app.py
- Command line
-
hf download hf://Mirutex/Celyrix-1.0-Vision/app/app.py
-
curl -L -o app.py https://huggingface.co/Mirutex/Celyrix-1.0-Vision/resolve/main/app/app.py
3.09 kB
| import os | |
| from functools import lru_cache | |
| import gradio as gr | |
| from app.inference import WARNING, Predictor | |
| from app.ui import CSS, DESCRIPTIONS, build_theme | |
| def predictor(): | |
| return Predictor() | |
| def classify(path): | |
| if not path: | |
| raise gr.Error("Please upload a JPEG or PNG satellite patch.") | |
| try: | |
| result = predictor().predict(path) | |
| except (ValueError, OSError, RuntimeError) as exc: | |
| raise gr.Error(str(exc)) from exc | |
| return ( | |
| path, | |
| result["probabilities"], | |
| f"### {result['label']}\n{DESCRIPTIONS[result['label']]}", | |
| ) | |
| def build_app(): | |
| with gr.Blocks( | |
| title="CELYRIX | Mirutex Technologies", | |
| analytics_enabled=False, | |
| delete_cache=(60, 60), | |
| ) as demo: | |
| gr.Markdown( | |
| "# CELYRIX\nSatellite Land Cover Classification\n\nDeveloped by Mirutex Technologies 路 Version 1.0.0" | |
| ) | |
| with gr.Row(): | |
| with gr.Column(): | |
| image = gr.File( | |
| type="filepath", | |
| file_types=[".jpg", ".jpeg", ".png"], | |
| label="Drop a JPEG or PNG satellite patch", | |
| elem_id="satellite-upload", | |
| ) | |
| preview = gr.Image( | |
| label="Uploaded image", interactive=False, height=210 | |
| ) | |
| button = gr.Button("Classify image", variant="primary") | |
| with gr.Column(): | |
| label = gr.Label(num_top_classes=5, label="Land-cover probabilities") | |
| explanation = gr.Markdown( | |
| "Upload an image to run local neural-network inference." | |
| ) | |
| gr.Markdown(WARNING) | |
| gr.Markdown( | |
| "**Technical details:** 64脳64 RGB input 路 TensorFlow/Keras CNN trained from scratch 路 CPU inference. " | |
| "Images are processed on this application server; no third-party inference service is used. " | |
| "Temporary upload files are removed by the application cache cleanup. " | |
| "Research use only; geographic generalization is unverified." | |
| ) | |
| repo = os.getenv("CELYRIX_MODEL_REPO") | |
| if repo: | |
| gr.Markdown(f"[Model repository](https://huggingface.co/{repo})") | |
| else: | |
| gr.Markdown( | |
| "Model repository: publication pending; this demo uses local release weights." | |
| ) | |
| gr.Markdown( | |
| "[Dataset and authors](https://github.com/phelber/EuroSAT) 路 [Official dataset archive](https://zenodo.org/records/7711810) 路 [Mirutex Technologies](https://mirutex.ru)" | |
| ) | |
| button.click( | |
| classify, | |
| image, | |
| [preview, label, explanation], | |
| api_name="classify", | |
| concurrency_limit=1, | |
| ) | |
| return demo | |
| demo = build_app() | |
| if __name__ == "__main__": | |
| demo.queue(max_size=16).launch( | |
| server_name=os.getenv("GRADIO_SERVER_NAME", "127.0.0.1"), | |
| max_file_size="10mb", | |
| share=False, | |
| css=CSS, | |
| theme=build_theme(), | |
| ) | |