Download app.py from kedimestan/mobilevitRetinoblastomaClassification: direct link, hf CLI and curl.
- Browser
- Download file 695 Bytes
-
https://huggingface.co/spaces/kedimestan/mobilevitRetinoblastomaClassification/resolve/main/app.py
- Command line
-
hf download hf://spaces/kedimestan/mobilevitRetinoblastomaClassification/app.py
-
curl -L -o app.py https://huggingface.co/spaces/kedimestan/mobilevitRetinoblastomaClassification/resolve/main/app.py
695 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| from PIL import Image | |
| # Swin modelini pipeline ile yükle | |
| model_name = "kedimestan/mobilevit-x-small" | |
| classifier = pipeline("image-classification", model=model_name) | |
| # Tahmin fonksiyonu | |
| def predict(image: Image.Image): | |
| # Görüntüyü sınıflandırma yaparak tahmin edin | |
| image = image.resize((250, 250)) | |
| result = classifier(image) | |
| return result[0]["label"] | |
| # Gradio arayüzü | |
| inputs = gr.Image(type="pil", label="Görsel Yükle") | |
| outputs = gr.Textbox(label="Tahmin Sonucu") | |
| gr.Interface( | |
| fn=predict, | |
| inputs=inputs, | |
| outputs=outputs, | |
| title="Retinoblastoma Tespiti", | |
| theme="default" | |
| ).launch(debug=True) |