File size: 695 Bytes
1c4953c
5216e95
1c4953c
 
5216e95
7b13da7
5216e95
1c4953c
 
 
5216e95
7b13da7
8049f05
5216e95
1c4953c
 
 
 
 
 
 
 
 
5216e95
1c4953c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)